Subject: Re: Quick RegExp question
To: Martin Weber <Ephaeton@gmx.net>
From: Paul Goyette <paul@whooppee.com>
List: current-users
Date: 04/21/2003 17:13:01
(Re-adding current-users to the list, since I didn't realize it had
been removed!)

In this particular example, I could of course rewrite the RegExp as

	^704:[^2].*$'

But the "real" customer request is for '2' to be some arbitrary char
sequence, say "123".  Using the [^...] structure, I would have to say

	^704:(([^1].{2})|(1[^2].)|(12[^3])|(.{2})|(.{4,}))$

which is of course very ugly and not supportable!  :)

On Tue, 22 Apr 2003, Martin Weber wrote:

> On Mon, Apr 21, 2003 at 04:56:51PM -0700, Paul Goyette wrote:
> > Nope, none of that helps!   Without the 2nd level of escaping, grep
> > returns nothing at all, and grep -E still returns the single line
> > containing one repetition of the '2'
> >
> > 	pc1:paul {213} cat xxx
> > 	704:1
> > 	704:2
> > 	704:3
> > 	pc1:paul {214} grep '^704:(2){0}$' xxx
> > 	pc1:paul {215} grep ^704:\(2\)\{0\}\$ xxx
> > 	pc1:paul {216} grep -E ^704:\(2\)\{0\}\$ xxx
> > 	704:2
> > 	pc1:paul {217}
> >
> > The desired results are to return all lines that
> > 	* start with '704:' and
> > 	* the rest of the line is NOT '2'
>
> Hmm. Okay, this either is a bug in our grep (for the -E case), assuming
> min 1 occurances, or okay (in the not -E case) depending on how you look
> at it:
>
> You say, I have ^704: and THEN I WANT A '2', but zero occurances of that.
> Nothing satisfies that though ...
>
> Hmm, I'm confused by it, too.. sorry can't help you there :(
>
> -Martin
>

----------------------------------------------------------------------
|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:   |
| Network Engineer | 9DC5 05CF 1AE7 DC42 CCC6 |  paul@whooppee.com   |
|  & World Cruiser | 6858 051E 7AD2 A6B2 4954 | pgoyette@juniper.net |
----------------------------------------------------------------------