I just want to know whether ruby regex has a not match operator just like !~ in perl. I feel it’s inconvenient to use (?!xxx)or (?<!xxxx) because you cannot use regex patterns in the xxx part.
I just want to know whether ruby regex has a not match operator just
Share
Yes:
!~works just fine – you probably thought it wouldn’t because it’s missing from the documentation page ofRegexp. Nevertheless, it works: