Is there a simple way to match all characters in a class except a certain set of them? For example if in a lanaguage where I can use \w to match the set of all unicode word characters, is there a way to just exclude a character like an underscore "_" from that match?
Only idea that came to mind was to use negative lookahead/behind around each character but that seems more complex than necessary when I effectively just want to match a character against a positive match AND negative match. For example if & was an AND operator I could do this...
^(\w&[^_])+$
[\w-[_]]
to exclude the underscore. – HamZa\w
only recognizes the ASCII word characters ([A-Za-z0-9_]
), not the full Unicode set. Same goes for Python's built-inre
flavor. – Alan Moore