Although I am by no means a regular expression expert, I do not believe that
^1 [0-9]*$ will match an AS-path of 1; the space forces a requirement of  a
maximum of two path elements, with the first element a 1. A single AS-path
of 1 would not match. Multiple AS-path elements are separated by a space .
Thus, the expression would match 1 100, 1 200, 1 1, 1 {any AS number}, but
would not match just 1. What is confusing about regular expressions is that
every element in the expression is an operator, and sometimes you have
operators acting on other operators. Thus .* matches all paths because . is
an operator representing any single character and * is an operator
representing . repeated as many times as necessary (not just the particular
character that . matched). This is thus equivalent to .., ..., ...., etc. as
many times as necessary.

Powerful, but cryptic, and not well-documented at all by Cisco (who knows
which type of regular expression engine they are using?) This all comes from
the Unix world, which is why you see it in Perl, Tcl, egrep, etc.

Regards,
MLC
"vtam" <[EMAIL PROTECTED]> wrote in message 907i83$9l6$[EMAIL PROTECTED]">news:907i83$9l6$[EMAIL PROTECTED]...
> The space is the books. Because it said it match all the AS_paths that
start
> with 1 and of length 2, such as AS_path=1, =1 10, =1 200, etc. As you
said,
> ? # 0 or 1 of the preceding characters (in this case a space). So if ?=0,
it
> is ^1[0-9]*$; if ?=1, it is ^1 [0-9]*$.
> Do i misread your meaning?
>
>
> "Drew Simonis" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > ^1 ?[0-9]*$
> >   ^
> >   ^
> >
> > Is that space yours or the books?  Broken apart, that regex matches
> > (assuming standard egrep'ish metachars)
> >
> > ^ # beginning of line
> > 1 # followed by the digit 1
> > (space) # followed by a space
> > ? # 0 or 1 of the preceding characters (in this case a space)
> > [0-9] # a single digit within the range of 0-9
> > * # 0 or more of the preceding characters, up to the end of
> > # the pattern
> > $ # end of line char
> >
> > So, is this equivalent to ^1[0-9]*$?  I don't think so.  Assuming
> > that the pattern with a space was a typo, we are allowed an
> > optional 1. Assuming it wasn't a typo, we are allowed the space
> > character.  Neither of these options would be matched by your more
> > restrictive pattern.  As for the specific pattern to match, you
> > can't really say without knowing what you are matching with.
> >
> > Different regex engines support different metachars.
>
>
>
> _________________________________
> FAQ, list archives, and subscription info:
http://www.groupstudy.com/list/cisco.html
> Report misconduct and Nondisclosure violations to [EMAIL PROTECTED]
>


_________________________________
FAQ, list archives, and subscription info: http://www.groupstudy.com/list/cisco.html
Report misconduct and Nondisclosure violations to [EMAIL PROTECTED]

Reply via email to