short answer is that REs with negation form a closed <mathematical entity>
(I'll get back on what entity after reviewing old notes with Doug McIlroy)

our minds intuitively handle REs without negation
because they are essentially filtering operations
that narrow down the set of strings generated by an RE

negation means *all* of the strings not matched by the negated pattern
and our minds don't visualize that too well
because its a really big set
including all subsets of the negated RE
that's the intuition killer

On Wed, 16 Feb 2011 20:17:17 +0100 Roland Mainz wrote:
> On Wed, Feb 16, 2011 at 3:50 PM, Icarus Sparry
> <[email protected]> wrote:
> > On 2/15/2011 10:30 PM, ÏÌØÇÁ ËÒÙÖÁÎÏ×ÓËÁÑ wrote:
> >> Glenn, why does this grep line print chicken_long, despite the
> >> negation operator to filter '_long"?
> >>
> >> printf "chicken_x\nchicken_long\n" | ./arch/linux.i386/bin/grep -X
> >> 'chicken((_long)!)'
> >> chicken_x
> >> chicken_long
> >
> > Negation often gives results that are not intuitive.
> > I suggest you use the '-b' flag if you are on an terminal that supports
> > ANSI escape sequences, in which case you will see that it matched
> > "chicken_lon" (no 'g'),

> Somehow this feels wrong.

> Glenn: Does ! always only match one single character, even if ! is
> precended by a bracket pair (e.g. "(foo)!") ?

> > and then printed out the entire line. Changing
> > the expression to 'chicken((_long)!)$' gives you the result you appear
> > to be expecting.

> Erm... can anyone explain in detail why grep -X works this way in
> detail, please ?

> ----

> Bye,
> Roland

> -- 
> š __ .š . __
> š(o.\ \/ /.o) [email protected]
> š \__\/\/__/š MPEG specialist, C&&JAVA&&Sun&&Unix programmer
> š /O /==\ O\š TEL +49 641 3992797
> š(;O/ \/ \O;)

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to