RE: Re: A matter of a regular Expression

From: Ryan West <rwest_at_zyedge.com>
Date: Mon, 13 Apr 2009 09:13:23 -0400

Aly,

Nice post, I just verified your version works fine and can be easily adjusted to "allow ASXXXX and any of their customers routes."

Here is yours for ^7018$ and any other number of combinations afterwards.

s ip b q ^7018(_[0-9]+)*$

It is much simpler in that format. I guess it's good to know the other way just in case the scenario is "allow ASXXXX and as many as 2 of their directly connected customers."

s ip b q ^7018((_[0-9]+)?(_[0-9]+))?$

BTW, if someone knows a more efficient way to do the above regex, please let me know.

Thanks,

-ryan

-----Original Message-----
From: nobody_at_groupstudy.com [mailto:nobody_at_groupstudy.com] On Behalf Of Cyrus
Sent: Monday, April 13, 2009 4:53 AM
To: aly.groupstudy_at_gmail.com; Naveen
Cc: ccielab_at_groupstudy.com
Subject: Re: Re: A matter of a regular Expression

Well Aly,

I'm a bit angry about myself since my memory is rusty about regular
expressions in Cisco rather Linux world ,specifically "_" character. so I
doubted about my first message.

After closer look and looking into Cisco regular expression Reference.

http://www.cisco.com/en/US/docs/ios/12_2/termserv/configuration/guide/tcfaapre_ps1835_TSD_Products_Configuration_Guide_Chapter.html

I was correct at my first message. your expression is as same as workbook's
Solution.That one wants to separate "space by putting whole expression
"_[0-9]+" in () but u match on " _" that matches end of string or space.

*1) Do not match AS100 Only routes.
*
"_" Replaces a long regular expression list by matching a comma (,), left
brace ({), right brace (}), the beginning of the input string, the end of
the input string, or a space.

so ^100_[1-9]*$ would match ^100$ as well

*2) Without a "0" in [1-9], it won't match AS numbers like 300, 500, 405
etc.*
obviously it was typo --> [0-9]

*3)The * would match everything. AS100's customer's customers and their
customers etc.*

"*" Matches zero or more sequences of the character preceding the asterisk.

so it wouldn't match 100 300 400. [0-9]* would not match "space".

So they are pretty same.yours is a simpler version.

HTH,

Cyrus

On Mon, Apr 13, 2009 at 6:19 PM, <aly.groupstudy_at_gmail.com> wrote:

> Sorry for the typo mistake ^100_[1-9]*$ should of course be ^100_[0-9]*$
>
> Actually Cyrus you are correct
>
> 1) Do not match AS100 Only routes.
> ^100_[0-9]*$ will match routes originated from 100
> note the * matches "ZERO" or more occurance
>
>
> 2) Without a "0" in [1-9], it won't match AS numbers like 300, 500, 405
> etc.
> sorry my mistake should be ^100_[0-9]*$ but we all get the idea ( clumsy
> me)
>
>
> 3) The * would match everything. AS100's customer's customers and their
> customers etc.
> No I do not think it would as the range [0-9] does not include the space
> char
> or the _ operator
>
> I still thinks they would work the same with mine only shorter and maybe
> simpler
>
>
> Blogs and organic groups at http://www.ccie.net
>
> _______________________________________________________________________
> Subscription information may be found at:
> http://www.groupstudy.com/list/CCIELab.html
>
>
>
>
>
>
>
>

-- 
Sirus Moghadasian
CCIE #21862 (R&S)
Blogs and organic groups at http://www.ccie.net
Received on Mon Apr 13 2009 - 09:13:23 ART

This archive was generated by hypermail 2.2.0 : Mon May 04 2009 - 07:39:11 ART