Regular expressions help

John Hazen invalid at hazen.net
Wed Feb 25 19:30:32 EST 2004


> Mike Hearne wrote on 24 Feb 2004 10:54:45 -0800:
> 
> > Given the following three lines:
> > 
> > name fredgeorge
> > name georgeharry
> > name george
> > 
> > I'm trying to find a regular expression that matches only the third
> > one.

* Andrei <fake at fake.net> [2004-02-24 12:34]:
> It's pretty easy:
> 
> "name george$"
> 
> "$" means end of string

And if you'd also prefer not to match:

name name george

Then, you could match for:
"^name george$"

"^" means the beginning of the string.

-John
< my_first_name AT my_last_name DOT net >




More information about the Python-list mailing list