Is it possible to define a regex which will match every character except a certain defined character or set of characters?
Basically, I wanted to split a string by either comma (,) or semi-colon (;). So I was thinking of doing it with a regex which would match everything until it encountered a comma or a semi-colon.
This question is related to
regex
Use this:
([^,;]*[,;])*
use a negative character class:
[^,;]+
Use character classes. A character class beginning with caret will match anything not in the class.
[^,;]
Source: Stackoverflow.com