From: Chan Hong (chan_hong33@yahoo.com)
Date: Wed Dec 12 2007 - 12:34:10 ART
Thanks Scott!!
I always think that that result is caused by the repeat
pattern, but forget that if the pattern of regxp matched, the rest of the
characters can be ignored..................
----- 6l%s-l%s ----
1H%s$H!R
Scott Morris <smorris@ipexpert.com>
&,%s$H Chan Hong <chan_hong33@yahoo.com>;
certification Cisco <ccielab@groupstudy.com>
6G0e$i4A!R 2007 &~ 12$k 11 $i
,P4A$G $U$H 10:43:01
%DCD!G RE: Regular Expression
Solve it like you would a
math equation... by that, things inside () are
solved separately.
So:
* = 0
or more of preceeding character.
[] = range representing a single character.
So the * immediately follows
the [0-9], which means 0 or more number values.
_
= parsing character, which in an AS Path means beginning of line, space,
or
end of line.
So you end up with:
1 followed by 2 followed by 3 followed by 4
followed by (space or end of
line). If space then you have 0 or more integer
characters and then MUST
have end of line. So no more spaces (extra AS
numbers) can be included.
In your show command, you didn't force the end of
the string, so all of
those match. it's kind of like using "show ip bgp
regexp 100" and you will
find positive results from 100, 1100, 1001, 10011,
10087, 21004, etc.
because they all include the string "100" with no other
restrictions!
HTH,
Scott Morris, CCIE4 (R&S/ISP-Dial/Security/Service
Provider) #4713, JNCIE-M
#153, JNCIS-ER, CISSP, et al.
CCSI/JNCI-M/JNCI-ER
VP
- Technical Training - IPexpert, Inc.
IPexpert Sr. Technical Instructor
A
Cisco Learning Partner - We Accept Learning Credits!
smorris@ipexpert.com
Telephone: +1.810.326.1444
Fax: +1.810.454.0130
http://www.ipexpert.com
-----Original Message-----
From: nobody@groupstudy.com
[mailto:nobody@groupstudy.com] On Behalf Of Chan
Hong
Sent: Tuesday, December
11, 2007 8:53 AM
To: certification Cisco
Subject: Regular Expression
Dear
all,
I want to ask about regulat expression, * and [], () From my
understanding,
show ip bgp regxp 1234(_[0-9]*)$ will show all bgp route with
as path
starting from 1234 and zero or one other as in the as path (eg., 1234
4321,
or 1234) But if without $, the result is all bgp routes with as path
starting from 1234 and 0 or MORE other as in the as path (eg., 1234, 1234
4321, 1234 4321 4567 122) why??
$ means the end of the pattern, but which
symbol mean the repeat pattern???
The * is inside (), next to [0-9]. The
repeat pattern should apply on character 0-9 only. Inside the (), there is a
_
also, which can be "space" or end of string. Why without the $, the show
ip
bgp rexp 1234(_[0-9]*) can be something like:
R1#sh ip bgp regexp
1234(_[0-9]*)
BGP table version is 3, local router ID is 10.155.129.1 Status
codes: s suppressed, d damped, h history, * valid, > best, i - internal, r
RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete
Network
Next Hop Metric LocPrf Weight Path
*> 3.0.0.0
10.155.129.2
200 0 1234 103 80 i
*> 8.5.250.0/24
10.155.129.4 200
0 1234 10 13 15 i
*> 15.149.2.0/24
10.155.129.4 200 0 1234
10 i
Regards,
Howard
Yahoo! g62d8
e. e(f;g%o<fd= e&d=i2g/i;e."! h+
e
e>
http://hk.promo.yahoo.com/security/index.htmld:h'#f4e$!
This archive was generated by hypermail 2.1.4 : Tue Jan 01 2008 - 12:04:30 ARST