0

So I want a regex that finds for example a sequence of letters and non-digits and stops when it founds a hyphen.

Here's my regex: \D+(?=-)

For example: HELLO I'M LOOKING FOR HELP-

Would be: HELLO I'M LOOKING FOR HELP

And my regex works fine for 1 hyphen but if I write 2 hyphens like this for example: HELLO I'M LOOKING FOR HELP--

It takes the first hyphen as a match, so the result after the regex is applied is: HELLO I'M LOOKING FOR HELP-

Which is not what I want, any ideas of what I did wrong?

DheltaHalo
  • 109
  • 1
  • 6

0 Answers0