Re: raw strings in regexps

2006-12-08 Thread Mike
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] ... > You have to quote metacharacters if you want to match them. The escape > method is useful for this: > > >>> re.escape('(a)') > '\\(a\\)' Doh! Of course! Thanks everyone. -- Mike -- -- http://mail.python.o

Re: raw strings in regexps

2006-12-07 Thread Gabriel Genellina
At Friday 8/12/2006 02:53, Mike wrote: I finally simplified my problem down to this simple case: re.match(r'\\this', r'\\this') Both the pattern and the string to match are identical raw strings, yet they don't match. What does match is this: re.match(r'this', r'\\this') Perhaps y

Re: raw strings in regexps

2006-12-07 Thread Fredrik Lundh
Mike wrote: > I've been having trouble with a regular expression, and I finally simplified > things down to the point that (a) my example is very simple, and (b) I'm > totally confused. There are those who would say (b) is normal, but that's > another thread. > > I finally simplified my proble

Re: raw strings in regexps

2006-12-07 Thread Carl Banks
Mike wrote: > I've been having trouble with a regular expression, and I finally simplified > things down to the point that (a) my example is very simple, and (b) I'm > totally confused. There are those who would say (b) is normal, but that's > another thread. > > I finally simplified my problem dow