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
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
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 ],
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",
[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
"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
[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