Re: regular expression negate a word (not character)

2008-02-01 Thread Dr.Ruud
Greg Bacon schreef: > Dr.Ruud: >> I negated the test, to make the regex simpler: [...] > > Yes, your approach is simpler. I assumed from the "need it all > in one pattern" constraint that the OP is feeding the regular > expression to some other program that is looking for matches. Yes, I assumed

Re: regular expression negate a word (not character)

2008-01-29 Thread Greg Bacon
In article <[EMAIL PROTECTED]>, Dr.Ruud <[EMAIL PROTECTED]> wrote: : I negated the test, to make the regex simpler: [...] Yes, your approach is simpler. I assumed from the "need it all in one pattern" constraint that the OP is feeding the regular expression to some other program that is looki

Re: regular expression negate a word (not character)

2008-01-28 Thread Dr.Ruud
Greg Bacon schreef: > #! /usr/bin/perl > > use warnings; > use strict; > > use constant { > MATCH=> 1, > NO_MATCH => 0, > }; > > my @tests = ( > [ "winter tire",=> MATCH ], > [ "tire", => MATCH ], > [ "retire", => MATCH ],

Re: regular expression negate a word (not character)

2008-01-28 Thread Greg Bacon
The code below at least passes your tests. Hope it helps, Greg #! /usr/bin/perl use warnings; use strict; use constant { MATCH=> 1, NO_MATCH => 0, }; my @tests = ( [ "winter tire",=> MATCH ], [ "tire", => MATCH ], [ "retire",

Re: regular expression negate a word (not character)

2008-01-26 Thread Ilya Zakharevich
[A complimentary Cc of this posting was sent to Summercool <[EMAIL PROTECTED]>], who wrote in article <[EMAIL PROTECTED]>: > so for example, it will grep for > > winter tire > tire > retire > tired > > but will not grep for > > snow tire > snow tire > some snowtires This does n

Re: regular expression negate a word (not character)

2008-01-25 Thread Mark Tolonen
"Summercool" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > somebody who is a regular expression guru... how do you negate a word > and grep for all words that is > > tire > > but not > > snow tire > > or > > snowtire > > so for example, it will grep for > > winter tire > ti

Re: regular expression negate a word (not character)

2008-01-25 Thread Ben Morrow
[newsgroups line fixed, f'ups set to clpm] Quoth Summercool <[EMAIL PROTECTED]>: > On Jan 25, 5:16 pm, Summercool <[EMAIL PROTECTED]> wrote: > > somebody who is a regular expression guru... how do you negate a word > > and grep for all words that is > > > > tire > > > > but not > > > > snow ti