I have a regex \([0-9]+|\-)\ which either takes a number or a hyphen.
but if I use this to match something like -555 it still works because it matches the hyphen-. So I am wondering if there is a way to match the whole thing?
I have a regex \([0-9]+|\-)\ which either takes a number or a hyphen. but
Share
The
^means “at the beginning of thestringline”, and the$means “at its end”.Edit: fixed the answer, thanks to luke-gru. As pointed out in the comments,
\Ais at the start of the string,\Zis at its end. The behavior of^and$depends on whether multiline is enabled or not.