From: Tim Fletcher (tim@fletchmail.net)
Date: Fri Feb 21 2003 - 18:45:25 GMT-3
At 02:42 PM 2/21/2003 -0600, Swink, Dave wrote:
>Tim,
>
>The problem is to match "123_(any number of characters or no characters at
>all)456" or "456_(any number of characters or no characters at all)123".
But this would also match 123 1456 etc so you have to restrict the 2nd
number, in this case 456.
>The ".*" means one character or white space and 0 or more of the same, so
>the "_" you added would be needed. The "?" covers the possibility that
>there may not be any characters at all between 123_ and 456 by saying "the
>stuff in the pararentheses or maybe nothing".
Putting a "?" after the ".*" would have no effect at all. Let's take a
close look at this string and analyze it character by character
(.*)?
( - The beginning of a group of characters, does not match anything.
. - Match any single character.
* - Match any number of the previous character (including 0).
) - The end of a group of characters, does not match anything.
? - Match 0 or 1 of the preceding character, in this case everything inside
the parenthesis.
So the expression within the parentheses means any string of any length
(including 0 length which is a null string). The "?" says match 0 or 1 of
the expression within the parentheses, which in this case is any string of
any length. Since the expression within the parentheses will already any
string of any length, to say we can match 0 or 1 of these is irrelevant.
"(.*)?" will match any string of any length, but so will ".*".
But we still have the problem of being able to match both "123 456" and
"123 n 456" (where n is any number of ASs). Lets take a look at 2 expressions.
_123_456_ - Will match "123 456" but not "123 n 456"
_123_.*_456_ - Will match "123 n 456" but not "123 456"
If you look at the difference between these 2 expressions, the difference
is the ".*_" in the middle. So we can combine them into 1 expression if we
make that part optional.
_123_(.*_)?456_
-Tim Fletcher
>Dave Swink
>
>-----Original Message-----
>From: Tim Fletcher [mailto:tim@fletchmail.net]
>Sent: Friday, February 21, 2003 2:27 PM
>To: Swink, Dave; 'Cezar Fistik'; ccielab@groupstudy.com
>Subject: RE: Re:
>
>
>Dave,
>
>Your absolutely right, but your solution doesn't solve the problem. "."
>means any character and "*" means any number of the preceeding character or
>group of characters, so applying a "?" to that group has no meaning. The
>problem is that the 2 "_" would require at least 2 spaces between the 123
>and 456. Also you forgot a couple of necessary "_"s (probably just a typo).
>So what it should be is:
>
>_123_(.*_)?456_|_456_(.*_)?123_
>
>-Tim Fletcher
>
>At 11:36 AM 2/21/2003 -0600, Swink, Dave wrote:
> >Cezar,
> >
> >That answer matches "AS123 (any number of additional ASs) AS456" or "AS456
> >(any number of additional ASs) AS123" but it does not match "AS123 AS456"
>or
> >"AS456 AS123". That is why it needs the ? after the .* to give it the "or
> >nothing" option: _123_(.*)?_456|456_(.*)?_123
> >
> >Dave Swink
> >
> >-----Original Message-----
> >From: Cezar Fistik [mailto:cfistik@moldovacc.md]
> >Sent: Friday, February 21, 2003 6:28 AM
> >To: ccielab@groupstudy.com
> >Subject: Re: Re:
> >
> >
> >Hi all,
> >
> >Just realized it is not good. The expression 123.*456 would match also
> >AS1234 and/or AS3456 and so on, that is not the desired result. It also
> >wouldn't match AS-PATHS when AS456 is before AS123, so here comes a little
> >improvment:
> >
> >_123_.*_456|456_.*_123
> >
> >What do you think?
> >
> >Cezar Fistik
> >
> >----- Original Message -----
> >From: "Cezar Fistik" <cfistik@moldovacc.md>
> >To: <ccielab@groupstudy.com>
> >Sent: Friday, February 21, 2003 1:23 AM
> >Subject: Re:
> >
> >
> > > Hi,
> > >
> > > I don't know if there si an "and" in regular expressions, never heard of
> > > it. In order to match AS123 AND AS456 you can try using the following
> > > expressoin:
> > >
> > > 123.*456
> > >
> > > Regards,
> > > Cezar Fistik
> > >
> > > ----- Original Message -----
> > > From: "Ram Shummoogum" <rshummoo@ca.ibm.com>
> > > To: <ccielab@groupstudy.com>
> > > Sent: Thursday, February 20, 2003 10:34 PM
> > >
> > >
> > > > Hi ALL:
> > > >
> > > >
> > > > I need some help on this BGP regular expression.
> > > >
> > > >
> > > > Make a router only accept routes that has transit AS 123 and AS 456.
> >The
> > > > keyword here is "and" and not or.
> > > >
> > > >
> > > > Ex: {34 5 6 456 7 99 123 88}
> > > > {45 123 89 456 7}
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I know "OR" is | but what is AND.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Thanks for your help
> > > >
> > > >
> > > > RAM
This archive was generated by hypermail 2.1.4 : Sat Mar 01 2003 - 11:06:28 GMT-3