[c-nsp] Expression to match 1, 2, or 3 AS paths

Tim Franklin tim at pelican.org
Tue Jun 17 06:04:59 EDT 2008


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.




More information about the cisco-nsp mailing list