[Tutor] Regular expressions question

Ed Owens eowens0124 at gmx.com
Thu Dec 6 02:04:34 CET 2012


On 12/5/12 7:24 PM, Brett Ritter wrote:
> On Wed, Dec 5, 2012 at 4:13 PM, Ed Owens <eowens0124 at gmx.com 
> <mailto:eowens0124 at gmx.com>> wrote:
>
>     >>> str(string)
>     '[<div class="wx-timestamp">\n<div class="wx-subtitle
>     wx-timestamp">Updated: Dec 5, 2012, 5:08pm EST</div>\n</div>]'
>     >>> m = re.search('":\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)<',
>     str(string))
>     >>> print m
>     None
>
>
> It starts with ":
> which doesn't appear in your string.
the : is at the end of 'Updated: ', I think.  That did make me think 
about the " in the regular expression above, which I didn't remember. 
Just for completeness, here it is again, as copied:

 >>> m = re.search(':\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)<', str(string))
 >>> print m
None
 >>>

Ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121205/ffd96c2c/attachment.html>


More information about the Tutor mailing list