One more regular expressions question
horpner at yahoo.com
Thu Jan 18 14:50:12 CET 2007
On 2007-01-18, Victor Polukcht <vpolukcht at gmail.com> wrote:
> My pattern now is:
> And i expect to get:
> var1 = "Unassigned Number "
> var2 = "1"
> var3 = "32"
> I'm sure my regexp is incorrect, but can't understand where
Break it up using verbose notation to help yourself. Also, use
more helpful names. With names like var1 and var2 you might as
well not used named groups.
r = re.compile(r"""(?x)
(?P<error> [^(]+ )
(?P<errno> \d+ )
(?P<lineno> \d+ )""")
This way it's clearer that there's a \) with no matching \(.
This team is one execution away from being a very good basketball team. --Doc
Posted via a free Usenet account from http://www.teranews.com
More information about the Python-list