[Tutor] regex: not start with FOO

Bernard Rankin berankin99 at yahoo.com
Tue Feb 3 02:25:10 CET 2009




> > I'd like to match any line that does not start with FOO.  (Using just a reg-ex 
> rule)
> >
> > 1) What is the effective difference between:
> >
> > (?!^FOO).*
> >
> > ^(?!FOO).*
> >
> > 2) Is there a better way to do this?
> >
> 
> myline = 'FOO things in line'
> 
> >>> myline.startswith('FOO')
> True

Right.  However, I am trying to just do this in a general "does this match" regex environment.


      



More information about the Tutor mailing list