Which regular expression pattern will match a substring not containing a specific character in Python? For example, I have the string "abc,5 * de", and I want to match "abc" and "5 * de" as two substrings, but not the ,.
Which regular expression pattern will match a substring not containing a specific character in
Share
Use a negated character class that contains all characters you don’t want to match.
Something like
See it here on Regexr
The
[]denotes the character class and the^as first character makes it a negated class.