RE: Regular Expressions

From: Scott Morris (swm@emanon.com)
Date: Thu Sep 14 2006 - 12:20:19 ART


True, but then you don't have any other filtering information afterwards.
It's like saying I want to match the text "the" which exists in the, there,
further, soothe, and many other things. Without anchor points, what do you
expect?

Scott

-----Original Message-----
From: David Timmons [mailto:masterdt@yahoo.com]
Sent: Thursday, September 14, 2006 10:28 AM
To: swm@emanon.com; Heiko Liedtke; Fabio Rodrigues
Cc: ccielab@groupstudy.com
Subject: Re: Regular Expressions

Well,
 
I thought that the "?" mark was supposed to mean 1 or 0 matches. So, if you
have an expression:
 sh ip bgp regexp ^852_3?
 
I though this would mean that you could only have one and only one 3 in the
next AS or you don't have another AS to follow 852.
 
dt

 

----- Original Message ----
From: Scott Morris <swm@emanon.com>
To: David Timmons <masterdt@yahoo.com>; Heiko Liedtke
<heiko.liedtke@gmx.net>; Fabio Rodrigues <fleandror2@gmail.com>
Cc: ccielab@groupstudy.com
Sent: Wednesday, September 13, 2006 12:39:00 PM
Subject: RE: Regular Expressions

Sure it should, because you aren't giving any specific instructions AFTER
that 3. So 3, 33, 335, 3356 all match. If you put a $ at the end, you'd no
longer have that match (or a _ as well).

Scott Morris, CCIE4 (R&S/ISP-Dial/Security/Service Provider) #4713, JNCIE
#153, CISSP, et al.
CCSI/JNCI-M/JNCI-J
IPExpert VP - Curriculum Development
IPExpert Sr. Technical Instructor
smorris@ipexpert.com
http://www.ipexpert.com

-----Original Message-----
From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf Of
David Timmons
Sent: Tuesday, September 12, 2006 3:18 PM
To: Heiko Liedtke; Fabio Rodrigues
Cc: ccielab@groupstudy.com
Subject: Re: Regular Expressions

Hi,

I don't think the ? mark always work like you would expect. For example, I
would think that sh ip bgp regexp ^852_3?

should not match 3356 in the orginating AS; however, it shows up.

*> 6.14.0.0/15 154.11.63.85 0 852 3356 701
668 i
dt
----- Original Message ----
From: Heiko Liedtke <heiko.liedtke@gmx.net>
To: Fabio Rodrigues <fleandror2@gmail.com>
Cc: ccielab@groupstudy.com
Sent: Tuesday, September 12, 2006 12:40:58 PM
Subject: Re: Regular Expressions

AAaaaaahhhh!!
I hate regular expressions.... :-)

If you change the * with the + in the first expression, than the result is
as i told before..
Sorry for that..

* --> Matches ZERO or more preceding characters
+ --> Matches ONE or more preceding characters
? --> Matches ZERO or ONE prededing characters

Fabio Rodrigues schrieb:

>All,
>
>sorry for the insistence, but look the output below (use notepad ou
>courier
>font):
>
>R2#term len 0
>R2#sh ip bgp
>BGP table version is 171, local router ID is 150.1.2.2 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
>*>i0.0.0.0 129.1.17.7 0 200 0 100 i
>* 129.1.124.4 0 0 100 i
>* i28.119.16.0/24 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i28.119.17.0/24 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>*>i112.0.0.0 129.1.13.1 0 100 0 100 54 50 60 i
>*>i113.0.0.0 129.1.13.1 0 100 0 100 54 50 60 i
>* i114.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i115.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i116.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i117.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i118.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i119.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i129.1.3.0/25 129.1.13.1 2588160 100 0 i
>*> 129.1.23.3 2588160 32768 i
>* i129.1.3.128/25 129.1.13.1 2588160 100 0 i
>*> 129.1.23.3 2588160 32768 i
>* i129.1.17.0/24 129.1.13.1 0 100 0 i
>*> 129.1.23.3 5401600 32768 i
>* i129.1.45.0/29 129.1.13.1 0 100 0 100 i
>*> 129.1.124.4 0 0 100 i
>* i129.1.46.0/24 129.1.13.1 0 100 0 100 i
>*> 129.1.124.4 0 0 100 i
>* i129.1.58.0/24 129.1.13.1 2 100 0 100 i
>*> 129.1.124.4 2 0 100 i
>*> 205.90.31.0 192.10.1.254 0 0 254 ?
>*> 220.20.3.0 192.10.1.254 0 0 254 ?
>*> 222.22.2.0 192.10.1.254 0 0 254 ?
>R2#
>R2#
>R2#
>R2#
>R2#sh ip bgp regexp ^100_[0-9]*$
>BGP table version is 171, local router ID is 150.1.2.2 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
>*>i0.0.0.0 129.1.17.7 0 200 0 100 i
>* 129.1.124.4 0 0 100 i
>* i28.119.16.0/24 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i28.119.17.0/24 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i114.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i115.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i116.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i117.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i118.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i119.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i129.1.45.0/29 129.1.13.1 0 100 0 100 i
>*> 129.1.124.4 0 0 100 i
>* i129.1.46.0/24 129.1.13.1 0 100 0 100 i
>*> 129.1.124.4 0 0 100 i
>* i129.1.58.0/24 129.1.13.1 2 100 0 100 i
>*> 129.1.124.4 2 0 100 i
>R2#
>R2#
>R2#
>R2#
>R2#
>R2#sh ip bgp regexp ^100(_[0-9]+)?$
>BGP table version is 171, local router ID is 150.1.2.2 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
>*>i0.0.0.0 129.1.17.7 0 200 0 100 i
>* 129.1.124.4 0 0 100 i
>* i28.119.16.0/24 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i28.119.17.0/24 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i114.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i115.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i116.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i117.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i118.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i119.0.0.0 129.1.13.1 0 100 0 100 54 i
>*> 129.1.124.4 0 100 54 i
>* i129.1.45.0/29 129.1.13.1 0 100 0 100 i
>*> 129.1.124.4 0 0 100 i
>* i129.1.46.0/24 129.1.13.1 0 100 0 100 i
>*> 129.1.124.4 0 0 100 i
>* i129.1.58.0/24 129.1.13.1 2 100 0 100 i
>*> 129.1.124.4 2 0 100 i
>R2#
>
>
>This is the reason for my question. The output is the same.
>
>Tks,
>
>Fabio.
>
>
>
>----- Original Message -----
>From: "Peter Cresswell" <p-cresswell@iname.com>
>To: "'Heiko Liedtke'" <heiko.liedtke@gmx.net>
>Cc: "'Fabio Rodrigues'" <fleandror2@gmail.com>;
><ccielab@groupstudy.com>
>Sent: Tuesday, September 12, 2006 1:29 PM
>Subject: RE: Regular Expressions
>
>
>
>
>>Yeah I think that's what I meant, just without a real world example.
>>
>>expression 1 would be:
>>Matches routes that have been learnt from AS 100 but could have
>>originated anywhere except AS 100 (unless route included pre-pending).
>>
>>Expression 2 would be:
>>Matches routes that have been learnt from AS 100 and have originated
>>from
>>
>>
>an
>
>
>>AS directly connected to AS 100 (e.g. AS YOU-----AS100------AS200), but
>>not routes that are more than 2 as hops away (e.g. not match AS
>>YOU----AS100----AS200---AS3000).
>>
>>I think that is a better explanation than my first attempt :-)
>>
>>Peter
>>
>>-----Original Message-----
>>From: Heiko Liedtke [mailto:heiko.liedtke@gmx.net]
>>Sent: 12 September 2006 17:19
>>To: Peter Cresswell
>>Cc: 'Fabio Rodrigues'; ccielab@groupstudy.com
>>Subject: Re: Regular Expressions
>>
>>Sorry,
>>
>>but I think that bouth of you are wrong...
>>
>>First Expression
>>
>>^100(_[ 0-9]+)?$
>>
>>This matches all paths coming from AS100 and have or have not
>>originated
in
>>another AS. This means, that the paths could have originated in AS100
>>
>>e.g.
>>100 999
>>100 1
>>100 546
>>100
>>
>>Second Expression
>>
>>^100_[0-9]*$
>>
>>This matches all paths coming from AS100 and have originated in
>>another
AS.
>>This means, that the paths could not have originated in AS100
>>
>>e.g.
>>100 999
>>100 1
>>100 5456
>>
>>Regards
>>
>>Heiko
>>
>>
>>
>>
>>
>>Peter Cresswell schrieb:
>>
>>
>>
>>>Fabio,
>>>
>>>The difference is the bottom one will match multiple as's in an as
>>>path becoase the _ is also allowed to be repeated. The 2nd one will
>>>only match "100 " then a list of digits between 0-9 without any spaces.
>>>
>>>
>>>E.g.
>>>
>>>Expression 1 would match:
>>>100 200 300 111
>>>
>>>Expression 2 would match:
>>>
>>>100 200300111
>>>
>>>Regards,
>>>
>>>Peter
>>>
>>>-----Original Message-----
>>>From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf
>>>Of Fabio Rodrigues
>>>Sent: 12 September 2006 16:12
>>>To: ccielab@groupstudy.com
>>>Subject: Regular Expressions
>>>
>>>Hi All,
>>>
>>>does anyone knows to say the difference of the effect (if exists) of
>>>these two regular expressions?
>>>
>>>^100(_[ 0-9]+)?$
>>>^100_[0-9]*$
>>>
>>>
>>>Tks,
>>>
>>>
>>>Fabio.
>>>
>>>_____________________________________________________________________
>>>__ Subscription information may be found at:
>>>http://www.groupstudy.com/list/CCIELab.html
>>>
>>>_____________________________________________________________________
>>>__ Subscription information may be found at:
>>>http://www.groupstudy.com/list/CCIELab.html
>>>
>>>
>
>_______________________________________________________________________
>Subscription information may be found at:
>http://www.groupstudy.com/list/CCIELab.html



This archive was generated by hypermail 2.1.4 : Sun Oct 01 2006 - 16:55:40 ART