How can I write a Regular Expression to match,
a string which does not contain the underscore "_".
How can I write a Regular Expression to match,
a string which does not contain the underscore "_".
/^[^_]*$/
The [^] syntax means "do not include any of these characters".
To match a character that is not an underscore you'd use [^_]
(the ^
means "not"). So to match a whole string you'd do something like this:
/[^_]+/