pattern match

Mike Rovner mike at bindkey.com
Tue Apr 22 21:25:19 EDT 2003


"Mitch MF Cummstain" <greg.bland at valpo.edu> wrote in message
news:220420031949394828%greg.bland at valpo.edu...
>                I just started using python and I need help with a
> pattern match.
>
>    m = re.match("(.{30})(word)(.{30})",paragraph);
>
> I need to match 30 characters on each side of word.  The problem word
> is getting treated as a string not a variable like I need it to.  How
> can I make it treat word as a variable ?

m = re.match("(.{30})%s(.{30})" % re.escape(word),paragraph)








More information about the Python-list mailing list