RE: BGP Reg Exp

From: Bit Gossip (bit.gossip@chello.nl)
Date: Sat Jan 06 2007 - 13:36:16 ART


Hi Geert,
what we want here is 174 followed by ONE as eventually repeated;
Your first proposal doesn't enforce that ONE may follow 174; an example:

show ip bgp regexp _174(_[0-9]+)*$

*>i12.18.158.0/23 1.1.1.1 0 250 0 174 16713 22647 i
*>i12.18.160.0/22 1.1.1.1 0 250 0 174 16713 22647 i
*>i12.20.147.0/24 1.1.1.1 0 250 0 174 174 174 174
16810 21689 i

The second one instead works !-)

_174(_[0-9]+)?(\1)*$

Thanks a lot,
Luca

On Fri, 2007-01-05 at 21:11 +0100, Geert Nijs wrote:
> All,
>
> The expression
>
> _174(_[0-9]+)*\1*$
>
> is not right. I expect problems with it.
> The problem is the * after (_[0-9]+)*
>
> This matches a number of times a number, so in the case of
> 174 174 174 174
>
> the part between () could match ( 174 174)
> In this case it is uncertain where the brackets should stop and where the \1 can start.....
>
> Why not use the much simplier:
>
> _174(_[0-9]+)*$
>
> It matches _174 and any repeating of another number.....
> The * means 0 or 1 times THAT BETWEEN brackets. So the number between () must be the same to match ???
> If that is not the case - i am not sure how Cisco parses the RegEx -
> than the following should also work:
>
> _174(_[0-9]+)?(\1)*$
>
>
>
>
> regards,
> Geert
> CCIE 13729
>
> -----Oorspronkelijk bericht-----
> Van: nobody@groupstudy.com [mailto:nobody@groupstudy.com] Namens Bit Gossip
> Verzonden: donderdag 28 december 2006 23:47
> Aan: Huizinga, Rene
> CC: ccielab@groupstudy.com
> Onderwerp: RE: BGP Reg Exp
>
>
> Hi Rene, GS,
> it seems to work quite erratically:
>
> re1>show ip bgp regexp _174(_[0-9]+)*\1*$
> .....
> *>i24.73.165.0/24 213.46.161.250 0 250 0 174 33363 i
> *>i24.73.234.0/24 213.46.161.250 0 250 0 174 33363
> 33363 i
> *>i24.75.137.0/24 213.46.161.250 0 250 0 174 174 174
> 174 16810 30299 30299 30299 30299 30299 30299 30299 i
> *>i24.75.140.0/24 213.46.161.250 0 250 0 174 174 174
> 174 16810 32425 i
> ....
>
> Look at the last one !!
>
> Luca.
>
>
> On Wed, 2006-12-27 at 22:45 +0100, Huizinga, Rene wrote:
> > Darn, not going well here today, forgetting the '*' after the first
> > expression to match the 0 or more occurances...sorry about
> > that...thinking of one thing, typing the other, that's what you get
> > when being half-focussed/having other things on your mind as well...
> > Probably one of the reasons why some people are failing a lab... :(
> >
> > So ^54(_[0-9]+)*\1*$
> >
> > Alternatively what should also work: ^54(_[0-9]*)\1*$
> >
> > Optionally again the \1 as (\1)
> >
> >
> > Cya
> > -----Original Message-----
> > From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf
> > Of Huizinga, Rene
> > Sent: Wednesday, December 27, 2006 10:28 PM
> > To: 'Bit Gossip'; ccielab@groupstudy.com
> > Subject: RE: BGP Reg Exp
> >
> > Hmm, now I see...
> >
> > Ehrm, not certain if no solution is possible and mention that quickly.
> > If it's really only for 1 REAL AS-depth behind AS54, how about:
> >
> > ^54(_[0-9]+)\1*$ ?
> >
> > :)
> >
> > That would match from left to right:
> >
> > - Something starting with AS54
> > - 0 or more instances of something having '_' (space) directly
> > followed with a set of [0-9] digits immediately behind
> > - And now comes the trick... The '\1' indicates that it should match
> > (ONLY) exactely again what it found in the last match between round
> > brackets with the '*' that it should do this 0 or more times...
> >
> > It can be that for that last one you also need the '\1' between round
> > brackets, but would need to check that out in the cmd-reference for
> > regexp's... But this is what it comes down to... (So in that case:
> > ^54(_[0-9]+)(\1)*$ )
> >
> > But check it out yourself, my last bookmark on this was:
> > http://www.cisco.com/en/US/products/sw/iosswrel/ps1828/products_comman
> > d_refe
> > rence_chapter09186a00800ca541.html
> >
> > I'd say, paste it into a few lab-routers and check it out... Either
> > with or without the round brackets it should work...
> >
> >
> > Cya
> >
> > Rene.
> >
> >
> > P.S.
> >
> > Even if it's wrong, I'd say 2 points for creativity... ;)
> >
> >
> > -----Original Message-----
> > From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf
> > Of Bit Gossip
> > Sent: Wednesday, December 27, 2006 9:29 PM
> > To: ccielab@groupstudy.com
> > Subject: RE: BGP Reg Exp
> >
> > Hi Rene, GS,
> > the original pb was: match all route of AS54 and its directly attached
> > customers, where a customer could prepend once or more The trick here
> > is that you don't know the AS of the customer before hand, so I agree
> > that unless you list all possible ASs, there is no solution for this
> > problem with a regular expression.... Luca.
> >
> >
> > On Wed, 2006-12-27 at 20:48 +0100, Huizinga, Rene wrote:
> > > Hi Luca,
> > >
> > >
> > > Not certain if I understand your question correctly, but if you want
> > > to accept all, with AND without prepending, try:
> > >
> > > ^54(_1234)+_
> > >
> > > Or ONLY when prepended:
> > >
> > > ^54(_1234)*_1234_
> > >
> > > In my understanding, this should be correct, correct me if I'm wrong
> > > or please explain your question in case of misunderstandings...
> > >
> > >
> > > Cya
> > >
> > > Rene.
> > >
> > > -----Original Message-----
> > > From: nobody@groupstudy.com [mailto:nobody@groupstudy.com] On Behalf
> > > Of Bit Gossip
> > > Sent: Wednesday, December 27, 2006 8:23 PM
> > > To: ccielab@groupstudy.com
> > > Subject: RE: BGP Reg Exp
> > >
> > > I was wandering if it is possible to make the expression smarter so
> > > that it can cope with the customer prepending once or more time;
> > > something
> > > like:
> > > 54 1234 1234 1234
> > > but not like
> > > 54 1234 4321
> > >
> > > I couldn't come to any solution....
> > >
> > > Luca.
> > >
> > > On Wed, 2006-12-27 at 09:11 -0500, Scott Morris wrote:
> > > > Both will work. Yours does 0 or more of the single character 0-9.
> > > > The first does one or more, but makes the whole thing optional with
> > > > the ? (0 or
> > > > 1 of preceeding).
> > > >
> > > > Different logic, same result!
> > > >
> > > >
> > > > 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 JB
> > > > Sent: Wednesday, December 27, 2006 4:59 AM
> > > > To: ccielab@groupstudy.com
> > > > Subject: BGP Reg Exp
> > > >
> > > > Hi all, question asks for a router to accept prefixes from BB1
> > > > that
> > > > have been originated by themselves and their directly connected
> > customers.
> > > >
> > > > Solution says: ^54(_[0-9]+)?$
> > > >
> > > > I got ^54_[0-9]*$.
> > > >
> > > > I ran mine thru looking-glass and it "seems" to work. I would
> > > > appreciate it if someone could explain the differences, if any,
> > > > between the two to further my understanding.
> > > >
> > > > TIA,
> > > >
> > > > JB
> > > >
> > > > __________________________________________________________________
> > > > __
> > > > __ _ 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
> >
> > ______________________________________________________________________
> > _
> > 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 : Thu Feb 08 2007 - 23:46:55 ART