re. module

Adrian Leu AdrianLeu at
Wed Nov 14 16:31:43 CET 2001

I am trying to figure out a solution for the following:

import re

text = 'name_0 goto place'
string = 'name|name_0|name_1'

pattern = re.compile(string, re.I)
d =

The problem is that my program will return 'name' to this. What I want
is for the search to return a match (if it exists) only after looking
at the whole string (name_0 in this case). I.e. in my example I would
like the program to return 'name_0' not 'name'.

Any ideas how I could do that?



More information about the Python-list mailing list