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. |
Looking for Comprehensive Cisco Data Center Training?
Take your data center skills to the next level with my deep-dive courses, designed for real-world application.
Modern DC Architecture & Automation:
- Cisco Data Centers | ACI Core
- Cisco Data Centers | ACI Automation With Ansible
- Cisco Data Centers | VXLAN EVPN
Core Protocols & CCIE Prep:
Need Personalized Guidance?
Additional Resources: Use Regular Expressions in BGP


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