BGP Regular Expressions make BGP route filtering clear and precise. With a few simple patterns, you can match AS-Paths (BGP PA), prefer the right routes, and block the wrong ones.
This post explains the basics and walks through a short AS-Path lab so you can use them in production today.
Commonly used BGP Regular Expressions:
| Expression | Meaning |
|---|---|
| .* | Match any routes. |
| ^$ | Match locally originated routes. |
| ^100_ | Match learned routes from neighboring autonomous system 100. |
| _100$ | Match routes were originated in autonomous system 100. |
| _100_ | Match routes that passed through autonomous system 100. |
| ^[0-9]+$ | Match routes from directly connected autonomous systems. |
Additional Resources: Use Regular Expressions in BGP


Simple and easy understandable , For new learner and Experiance guys .
Thank you Akram for your feedback, appreciated.