re. module

Emile van Sebille emile at
Wed Nov 14 16:49:41 CET 2001

"Adrian Leu" <AdrianLeu at> wrote in message
news:993ae4ca.0111140731.3c11e6d5 at
> 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 =
> return
> 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?

Also match the space character that follows the identifier?


Emile van Sebille
emile at


More information about the Python-list mailing list