Re: Regular expression question...


Subject: Re: Regular expression question...
From: David J. Weller-Fahy (dave-lists-aklug@weller-fahy.com)
Date: Mon Aug 18 2003 - 20:12:01 AKDT


* eclectric@ftml.net <eclectric@ftml.net> [2003-08-17 22:33]:
> > ^.*IN=eth1.*DST=[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[^2][^3][^2].*$
>
> well, the first error is the backslashes in front of the curly braces..
> they shouldn't be there as they keep the braces from being recognized as
> metacharaters (which they need to be for your regex to work).

Hrm... Seems to work when I get rid of the '[^2][^3][^2] portion. I
think that's just a difference between extended regex and basic regex
syntax. The part that I was really asking about (which I should have
specified) is the bit at the end, which you discuss next.

> fixing that should make your regex MOSTLY work... except for the 232
> bit.. the [^2][^3][^2] sequence will also exclude 2xy, x3y and xy2 for
> all digits x and y. I'm not coming up with a solution to this one off
> the top of my head for a normal regex, but maybe someone else can offer
> one.

I didn't think about the 2xy.. cases that you brought up. Have to bang
my head against it later. I tried to negate a group (using parentheses
surrounding the 232 instead of brackets for each individual number) but
that didn't work.

Is this one of those rare things that cannot be done well in REs?

Regards, and thanks for the tips...

-- 
David J. Weller-Fahy        | 'These are the questions that kept me out
largely at innocent dot com |  of the really *good* schools.'
www dot weller-fahy dot com |                  - One of The Group
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Mon Aug 18 2003 - 20:12:04 AKDT