Newbie backreference question
paulm
paulm at barley.vel.net
Thu Jun 30 19:00:33 EDT 2005
George Sakkis <gsakkis at rutgers.edu> wrote:
>
> Did you have a look at my other reply ? It's still the same, just
> change the regexp:
>
> import re
> a = 'test string two'
> b = re.match(r'test \w{2}(.+)', a, re.DOTALL).group(1)
> print b
>
> By the way, if you want to catch any single character (including new
> lines), '.' with re.DOTALL flag is more clear than [\W\w].
>
> George
>
Of course, this is the answer I need. I've been futzing
around with \1 and such without much luck. I'm still thinking a
bit too perlishly. :)
Thanks again, all!
More information about the Python-list
mailing list