RE: Regular Expression 2

From: Pete Yeargin \(pyeargin\) (pyeargin@cisco.com)
Date: Mon Dec 06 2004 - 16:06:16 GMT-3


I think if you break this down it makes a bit more sense.

The first expression is ^216_[0-9]*$

^ - Beginning of the string
216 - match any AS path sent from directly attached AS 216
_ - matches the beginning, end, {, }, or a comma
[0-9]* - matches zero or more occurrences of the digits 0-9
$ - end of the string

This will match any AS string beginning with 216 and containing one and only
one AS after that. The brackets specify a range but only match a single
character within the range. Since you don't have a trailing "_" after the
range, and the $ end of string character is used, it matches one and only
one additional AS.

The second expression is a bit odd... ^216_(.*)?$

(.*) - Since "." matches any single character including spaces,
you're basically saying to match zero or more characters which will match a
string of any length. In this case, the "?" has no effect on your pattern
match as this simply matches zero or one occurrences of any string which is
basically everything. I think the "*" should go on the outside of the
parentheses or you could simply remove the parentheses and say "^216_.*" .

-----Original Message-----
From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf Of
gladston@br.ibm.com
Sent: Monday, December 06, 2004 1:46 PM
To: ccielab@groupstudy.com
Subject: Regular Expression 2

I tested these two Regular Expression:

^216_[0-9]*$ - matches 216, 216_1200

^216_(.*)?$ - matches 216, 216_1200, 216_1200_777

I am trying to make a logical map (so I can remember it) of how IOS
interprets []* as just one AS and (.*) as one or more AS.

Any Idea?



This archive was generated by hypermail 2.1.4 : Mon Jan 03 2005 - 10:31:25 GMT-3