Regular expressions help

Bernard Delmée bdelmee at advalvas.REMOVEME.be
Tue Feb 24 14:36:50 EST 2004


> name fredgeorge
> name georgeharry
> name george
> 
> I'm trying to find a regular expression that matches only the third
> one.

'name george' would do, then ?!? If you mean 'george' on its
own as opposed to the previous variants, that'd be r'\bgeorge\b'.
One nifty tool to learn and experiment with re's is the
tools/scripts/redemo.py script normally present in your python installation.




More information about the Python-list mailing list