I have a strings like this:
blah-ha-ID:
asdf
I want to match all characters up till the final -ID:
So my initial regex was:
^[^-]+
This worked until words starting have hypnes in them. So in the example above, in blah-ha-ID: it would select up till blah when it should have got blah-ha.
So I was trying something like this, i want to repeat all characters that are not -ID
^[^-ID]+
But of course that wont work. I can't use capturing, and I need it to exclude the final -ID
More then workarounds I was hoping to learn how to do this, i recall there was a way to repeat up till a "word" in these character classes.
lastIndexOfinsteadlastIndexOfto replace.substr/substringwill help.-IDin there?