North American Network Operators Group

Date Prev | Date Next | Date Index | Thread Index | Author Index | Historical

Re: Regular Expressions ......

  • From: Yu Ning
  • Date: Mon May 29 04:30:39 2000

Hi,

Sorry for pick up the historic thread. But why not a more simple and
clear one?

ip as-path access-list 1 permit ^[0-9]+$
ip as-path access-list 2 permit ^([0-9]+) ([0-9]+)$
ip as-path access-list 3 permit ^([0-9]+) ([0-9]+)([0-9]+)$
ip as-path access-list 4 permit .*

It's quite clear, and you can expand it to whichever level you want.
Correct me if i were wrong.

regards,

Yu Ning
-------------------------------------------
(Mr.) Yu(2) Ning(2)
ChinaNet Backbone Operation
Networking Dep.,Datacom Bureau
China Telecom.,Beijing(100088),P.R.C
+86-10-66418105/66418121/66418123(fax)
-------------------------------------------

----- Original Message ----- 
From: "Peter T. Whiting" <[email protected]>
To: "Ally Gudgeon" <[email protected]>
Cc: <[email protected]>
Sent: Friday, May 26, 2000 7:40 PM
Subject: Re: Regular Expressions ......


> 
> 
> I see two problems.
> 
> 1. _ matches the beginning of the string, the end of the string,
> space, braces, comma, underscore or parentheses.  What you probably
> wanted in your regexp is a normal space. 
> 
> 2. * matches zero or more of the previous pattern, what you probably
> wanted was a + (you want to force it to have at least one
> digit.)
> 
> Fixing either one of these will produce the results you are
> looking for.  I recommend  fixing both.  Also, note that you
> can stack "beginning of string" or "end of string".  The 
> following produce the same result.
> 
> sho ip bgp reg ^_^^[0-9]*^^_^^_^[0-9]*$_$$
> sho ip bgp reg ^_^^[0-9]*$___$__[0-9]*$$_$
> sho ip bgp reg ^[0-9]*$
> 
> the point?  Be careful with * and _.
> 
> pete
> 
> 
> 
> On Fri, May 26, 2000 at 10:07:50AM +0100, Ally Gudgeon wrote:
> > 
> > Hi All,
> > 
> > I am having a few problems getting my BGP filtering to work - and am
> > experiencing some strange results..
> > 
> > I have two routers connected to a peering point, we have decided that we
> > want to set local preferences of
> > 
> > 110 to 1-deep AS-paths (as-path ACL 1)
> > 100 to 2-deep AS-paths (as-path ACL 2)
> > and 90 to 3-deep AS-paths (as-path ACL 3)
> > and to not accept 4-deep AS-paths (as-path ACL 4)
> > 
> > I have the following as-path ACLs to try to set that and am using route
> > maps.
> > 
> > ip as-path access-list 1 permit ^[0-9]*$
> > ip as-path access-list 2 permit ^[0-9]*_[0-9]*$
> > ip as-path access-list 3 permit ^[0-9]*_[0-9]*_[0-9]*$
> > ip as-path access-list 4 permit .*
> > 
> > This appears to have failed miserably....It is not setting local prefs
> > correctly if they are 3-deep and have a repetition of an AS number it sees
> > it as 4-deep
> > If they are 4 AS's deep it doesn't apply a local preference but if it knows
> > it from our other core router it sets a local pref of 100 but prefers the
> > direct route?
> > 
> > (ALSO: If I do a sh ip bgp reg ^[0-9]*_[0-9]*$ it lists both 1-deep and
> > 2-deep AS's....surely it should just list 2-deep?)
> > 
> > Any help would be greatly appreciated!......
> > 
> > Thanks in advance..
> > 
> > 
> > Ally
> > 
> > 
> > email - [email protected]
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > This email and any files transmitted with it are confidential and intended
> > solely for the use of the individual or entity to whom they are addressed.
> > The views expressed in the email and files transmitted with it are those of
> > the individual, not the company. If you have received this email in error
> > please notify [email protected]
> > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > 
> > 
> > 
> 
>