regex question
Paul McGuire
ptmcg at austin.rr._bogus_.com
Mon Jan 8 03:44:20 EST 2007
More information about the Python-list mailing list
Mon Jan 8 03:44:20 EST 2007
- Previous message (by thread): regex question
- Next message (by thread): regex question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"proctor" <12cc104 at gmail.com> wrote in message news:1168243020.304940.212700 at 42g2000cwt.googlegroups.com... > > > it does work now...however, one more question: when i type: > > rx_a = re.compile(r'a|b|c') > it works correctly! > Do you see the difference between: rx_a = re.compile(r'a|b|c') and rx_a = re.compile("r'a|b|c'") There is no difference in the variable datatype between "string" and "raw string". Raw strings are just a notational helper when creating string literals that have lots of backslashes in them (as happens a lot with regexps). r'a|b|c' is the same as 'a|b|c' r'\d' is the same as '\\d' There is no reason to "add raw strings" to your makeRE method, since you don't have a single backslash anywhere. And even if there were a backslash in the 'w' argument, it is just a string - no need to treat it differently. -- Paul
- Previous message (by thread): regex question
- Next message (by thread): regex question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list