I'm trying to match a hyphen in all situations except when it is preceded by whitespace and proceeded by non-whitespace.
x-y //match
x - y //match
x- y //match
x -y //not match
I want the regex to determine a match based on the above requirements but only capture the negative sign. Is this possible?
Thanks!
Edited for accuracy.