Hi Andrew,
The solution would be similar to this:
ip bgp new-format
!
ip community-list expanded NoComm666 deny _[0-9]+:666_
ip community-list expanded NoComm666 permit .*
!
route-map Filter permit 10
match community NoComm666
!
router bgp ...
neighbor X.X.X.X route-map Filter in
The first line in the comm-list NoComm666 defines a standalone community number whose part before the colon is an arbitrary group of digits, and the number after the colon is exactly 666, and such routes will be denied. All other routes will be accepted.
Be sure to use the ip bgp new-format command because that one is crucial for the whole exercise to work - the communities are fed to the community-list in the format defined by this command, and as the list is formatted for the XX:YY style, the actual communities must also be displayed in the same way.
Please be sure to try this in lab before testing this in a production network.
Best regards,
Peter