regexp

John Macdonald john-Z7w/En0MP3xWk0Htik3J/w at public.gmane.org
Sat Apr 24 18:43:33 UTC 2004


On Sat, Apr 24, 2004 at 02:22:19PM -0400, William Park wrote:
> On Sat, Apr 24, 2004 at 03:37:20PM +0300, Peter L. Peres wrote:
> > 
> > Hi all, I am trying to write a regexp that matches something like:
> > 
> > abc=def and anything else instead of def, but not:
> > 
> > abc=fgh
> > 
> > so I try to use negation on a block (conceptually below, it is not a
> > correct re):
> > 
> > /abc=!(fgh)
> 
> In shell,
>     shopt extglob
> In others,
>     abc=[^f][^g][^h]

That will reject "abc=deh" which I'd include in the
specified "def and anything else".  You need:

     /abc=(([a-eg-z][a-z][a-z])|([a-z][a-fh-z][a-z])|([a-z][a-z][a-gi-z]))/

It gets even messier if you also want to allow
other than exactly 3 lower case letters to be in the
assigned value.

-- 
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list