Re: [Tutor] regex: not start with FOO

2009-02-03 Thread Kent Johnson
On Tue, Feb 3, 2009 at 11:12 AM, Bernard Rankin wrote: > In [3]: re.findall('^(?!FOO)in', 'in in in') > Out[3]: ['in'] > > In [4]: re.findall('(?!^FOO)in', 'in in in') > Out[4]: ['in', 'in', 'in'] > > In [5]: re.findall('(?!FOO)in', 'in in in') > Out[5]: ['in', 'in', 'in'] > > In [6]: re.findall(

Re: [Tutor] regex: not start with FOO

2009-02-03 Thread Bernard Rankin
> > 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).* > > One difference is that the first will match starting anywhere in a > string, while the second will matc

Re: [Tutor] regex: not start with FOO

2009-02-03 Thread Bernard Rankin
> > 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).* > > One difference is that the first will match starting anywhere in a > string, while the second will matc

Re: [Tutor] regex: not start with FOO

2009-02-03 Thread Kent Johnson
On Mon, Feb 2, 2009 at 5:46 PM, Bernard Rankin wrote: > Hello, > > > 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).* One difference is that the first will match starting anywhere

Re: [Tutor] regex: not start with FOO

2009-02-02 Thread Bernard Rankin
> > 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.startswi

Re: [Tutor] regex: not start with FOO

2009-02-02 Thread Jervis Whitley
On Tue, Feb 3, 2009 at 9:46 AM, Bernard Rankin wrote: > Hello, > > > 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 thin

[Tutor] regex: not start with FOO

2009-02-02 Thread Bernard Rankin
Hello, 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? Thanks, :) ___ Tutor maillist - Tutor