Re: [c-nsp] Expression to match 1, 2, or 3 AS paths
Tim Franklin <> wrote on Tuesday, June 17, 2008 12:05 PM: > On Sat, June 14, 2008 5:08 am, Diogo Montagner wrote: > >> Some days ago I was trying to identify prepends using regular >> expressions without knowing the AS. > > You can do this with regexp back-references. > > ([0-9]+)(_\1)+ > > will match any AS that's prepended at least once, and > > ([0-9]+)(_\1)* > > will match the same AS any number of times. You could use explicit > repetitions of '_\1' if you want to match a specific number of > prepends. when using pattern recalls (i.e. \1,...), please check the DDTS mentioned in http://www.cisco.com/warp/public/707/cisco-sr-20070912-regexp.shtml as they could lead to a stack overflow.. oli ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
Re: [c-nsp] Expression to match 1, 2, or 3 AS paths
Thanks for all! Regards, ./diogo -montagner On Tue, Jun 17, 2008 at 7:04 AM, Tim Franklin <[EMAIL PROTECTED]> wrote: > On Sat, June 14, 2008 5:08 am, Diogo Montagner wrote: > >> Some days ago I was trying to identify prepends using regular >> expressions without knowing the AS. > > You can do this with regexp back-references. > > ([0-9]+)(_\1)+ > > will match any AS that's prepended at least once, and > > ([0-9]+)(_\1)* > > will match the same AS any number of times. You could use explicit > repetitions of '_\1' if you want to match a specific number of prepends. > > Regards, > Tim. > > > ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
Re: [c-nsp] Expression to match 1, 2, or 3 AS paths
On Sat, June 14, 2008 5:08 am, Diogo Montagner wrote: > Some days ago I was trying to identify prepends using regular > expressions without knowing the AS. You can do this with regexp back-references. ([0-9]+)(_\1)+ will match any AS that's prepended at least once, and ([0-9]+)(_\1)* will match the same AS any number of times. You could use explicit repetitions of '_\1' if you want to match a specific number of prepends. Regards, Tim. ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
Re: [c-nsp] Expression to match 1, 2, or 3 AS paths
Hi Darryl, many thanks. This was exactly my doubt. Some days ago I was trying to identify prepends using regular expressions without knowing the AS. Regards, ./diogo -montagner On Fri, Jun 13, 2008 at 11:47 PM, Darryl Dunkin <[EMAIL PROTECTED]> wrote: > You would have to specify the AS, as using wildcard digits won't > identify repetition. > > If you had 500 500 500 400, or 500 500 400 400, where 500 was connected > to you: ^500(_500)*(_400)*$ > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Diogo Montagner > Sent: Friday, June 13, 2008 18:54 > To: [EMAIL PROTECTED] > Cc: cisco-nsp@puck.nether.net > Subject: Re: [c-nsp] Expression to match 1, 2, or 3 AS paths > > Great! > > And how I could match prepends, ie, how I could identify AS paths > which has prepends ? > > Regards, > ./diogo -montagner > > > On Fri, Jun 13, 2008 at 7:21 PM, Deepak Jain <[EMAIL PROTECTED]> wrote: >> >> And since you can't have non-numeric AS numbers... you can always use > "." >> >> like ^.+$ >> >> DJ >> >> Daniel Faubel wrote: >>> >>> I like to use this: >>> >>> ^[0-9]+$ >>> ^[0-9]+_[0-9]+$ >>> ^[0-9]+_[0-9]+_[0-9]+$ >>> >>> -Daniel >>> >>> -Original Message- >>> From: [EMAIL PROTECTED] >>> [mailto:[EMAIL PROTECTED] On Behalf Of james edwards >>> Sent: Friday, June 13, 2008 1:41 PM >>> To: cisco-nsp@puck.nether.net >>> Subject: [c-nsp] Expression to match 1, 2, or 3 AS paths >>> >>> What have i done wrong here, I used to use this to match 1,2 and 3 AS >>> path, >>> for filtering down a full table: >>> >>> ^[0-9]*$ >>> ^[0-9]*_[0-9]*$ >>> ^[0-9]*_[0-9]*_[0-9]*$ >>> >>> >> ___ >> cisco-nsp mailing list cisco-nsp@puck.nether.net >> https://puck.nether.net/mailman/listinfo/cisco-nsp >> archive at http://puck.nether.net/pipermail/cisco-nsp/ >> > ___ > cisco-nsp mailing list cisco-nsp@puck.nether.net > https://puck.nether.net/mailman/listinfo/cisco-nsp > archive at http://puck.nether.net/pipermail/cisco-nsp/ > ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
Re: [c-nsp] Expression to match 1, 2, or 3 AS paths
You would have to specify the AS, as using wildcard digits won't identify repetition. If you had 500 500 500 400, or 500 500 400 400, where 500 was connected to you: ^500(_500)*(_400)*$ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Diogo Montagner Sent: Friday, June 13, 2008 18:54 To: [EMAIL PROTECTED] Cc: cisco-nsp@puck.nether.net Subject: Re: [c-nsp] Expression to match 1, 2, or 3 AS paths Great! And how I could match prepends, ie, how I could identify AS paths which has prepends ? Regards, ./diogo -montagner On Fri, Jun 13, 2008 at 7:21 PM, Deepak Jain <[EMAIL PROTECTED]> wrote: > > And since you can't have non-numeric AS numbers... you can always use "." > > like ^.+$ > > DJ > > Daniel Faubel wrote: >> >> I like to use this: >> >> ^[0-9]+$ >> ^[0-9]+_[0-9]+$ >> ^[0-9]+_[0-9]+_[0-9]+$ >> >> -Daniel >> >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of james edwards >> Sent: Friday, June 13, 2008 1:41 PM >> To: cisco-nsp@puck.nether.net >> Subject: [c-nsp] Expression to match 1, 2, or 3 AS paths >> >> What have i done wrong here, I used to use this to match 1,2 and 3 AS >> path, >> for filtering down a full table: >> >> ^[0-9]*$ >> ^[0-9]*_[0-9]*$ >> ^[0-9]*_[0-9]*_[0-9]*$ >> >> > ___ > cisco-nsp mailing list cisco-nsp@puck.nether.net > https://puck.nether.net/mailman/listinfo/cisco-nsp > archive at http://puck.nether.net/pipermail/cisco-nsp/ > ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/ ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
Re: [c-nsp] Expression to match 1, 2, or 3 AS paths
Great! And how I could match prepends, ie, how I could identify AS paths which has prepends ? Regards, ./diogo -montagner On Fri, Jun 13, 2008 at 7:21 PM, Deepak Jain <[EMAIL PROTECTED]> wrote: > > And since you can't have non-numeric AS numbers... you can always use "." > > like ^.+$ > > DJ > > Daniel Faubel wrote: >> >> I like to use this: >> >> ^[0-9]+$ >> ^[0-9]+_[0-9]+$ >> ^[0-9]+_[0-9]+_[0-9]+$ >> >> -Daniel >> >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of james edwards >> Sent: Friday, June 13, 2008 1:41 PM >> To: cisco-nsp@puck.nether.net >> Subject: [c-nsp] Expression to match 1, 2, or 3 AS paths >> >> What have i done wrong here, I used to use this to match 1,2 and 3 AS >> path, >> for filtering down a full table: >> >> ^[0-9]*$ >> ^[0-9]*_[0-9]*$ >> ^[0-9]*_[0-9]*_[0-9]*$ >> >> > ___ > cisco-nsp mailing list cisco-nsp@puck.nether.net > https://puck.nether.net/mailman/listinfo/cisco-nsp > archive at http://puck.nether.net/pipermail/cisco-nsp/ > ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
Re: [c-nsp] Expression to match 1, 2, or 3 AS paths
Thanks everyone. james ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
Re: [c-nsp] Expression to match 1, 2, or 3 AS paths
Nevermind. "." would match spaces as well. Should have read better. Deepak Jain wrote: And since you can't have non-numeric AS numbers... you can always use "." like ^.+$ DJ Daniel Faubel wrote: I like to use this: ^[0-9]+$ ^[0-9]+_[0-9]+$ ^[0-9]+_[0-9]+_[0-9]+$ -Daniel -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of james edwards Sent: Friday, June 13, 2008 1:41 PM To: cisco-nsp@puck.nether.net Subject: [c-nsp] Expression to match 1, 2, or 3 AS paths What have i done wrong here, I used to use this to match 1,2 and 3 AS path, for filtering down a full table: ^[0-9]*$ ^[0-9]*_[0-9]*$ ^[0-9]*_[0-9]*_[0-9]*$ ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
Re: [c-nsp] Expression to match 1, 2, or 3 AS paths
And since you can't have non-numeric AS numbers... you can always use "." like ^.+$ DJ Daniel Faubel wrote: I like to use this: ^[0-9]+$ ^[0-9]+_[0-9]+$ ^[0-9]+_[0-9]+_[0-9]+$ -Daniel -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of james edwards Sent: Friday, June 13, 2008 1:41 PM To: cisco-nsp@puck.nether.net Subject: [c-nsp] Expression to match 1, 2, or 3 AS paths What have i done wrong here, I used to use this to match 1,2 and 3 AS path, for filtering down a full table: ^[0-9]*$ ^[0-9]*_[0-9]*$ ^[0-9]*_[0-9]*_[0-9]*$ ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
Re: [c-nsp] Expression to match 1, 2, or 3 AS paths
I like to use this: ^[0-9]+$ ^[0-9]+_[0-9]+$ ^[0-9]+_[0-9]+_[0-9]+$ -Daniel -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of james edwards Sent: Friday, June 13, 2008 1:41 PM To: cisco-nsp@puck.nether.net Subject: [c-nsp] Expression to match 1, 2, or 3 AS paths What have i done wrong here, I used to use this to match 1,2 and 3 AS path, for filtering down a full table: ^[0-9]*$ ^[0-9]*_[0-9]*$ ^[0-9]*_[0-9]*_[0-9]*$ -- James H. Edwards Senior Network Systems Administrator Judicial Information Division [EMAIL PROTECTED] ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/ ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
[c-nsp] Expression to match 1, 2, or 3 AS paths
What have i done wrong here, I used to use this to match 1,2 and 3 AS path, for filtering down a full table: ^[0-9]*$ ^[0-9]*_[0-9]*$ ^[0-9]*_[0-9]*_[0-9]*$ -- James H. Edwards Senior Network Systems Administrator Judicial Information Division [EMAIL PROTECTED] ___ cisco-nsp mailing list cisco-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/