I'm trying to find a dash -
from a string if it match certain conditions and only the dash should be selected by regex.
Cases it should be selected -
- If both sides has space. Example:
test - dash
- If right hand side has space. Example:
test- dash
- If both sides don't have space. Example:
test-dash
Cases that it shouldn't be selected
- If there's no space on right side, but there's space on left side. Example:
test -dash
Here's my progress
as the screenshot shows, I can achieve with positive-lookbehind
, but this is not widely supported.
So, my question is, is there an alternative way to achieve this without using positive-lookbehind
?
Thanks.