Purpose of this article is to show how to match based on BGP community under routing peer policy
Versa supports regex based community match. Following are some of examples:
Example-1: Match community 7000:101 either in the beginning or end or at middle with NLRI having single or multiple communities
((^|,)7000:101($|,))
Example-2: Match community 7000:101 only at beginning
((^)7000:101($|,))
Example-3: Match community 7000:101 only at end
((^|,)7000:101($))
Example-4: Match community 7000:xxxx either in the beginning or end or at middle with NLRI having single or multiple
((^|,)7000:.*($|,))
Example-5: More complex matches with regex:
((^|,)1000(2|3|4|6|7|8|9|10):(1|3)0000($|,))
((^|,)65185:[1-9]($|,))|((^|,)65185:[1-9][0-9]($|,))|((^|,)65185:[1-9][0-9][0-9]($|,))