I've got a regex that I want to use to match word characters after a - if there are not any proceeding word characters.
(?<!\w)(?<=-)\w+
For the string
I want -to match a word-if it has a '-' bofore it and only-if '-' is not preceded by a word character.
I would expect it to only match to. However, it actually matches to, if, and if.
If I take the positive lookbehind out
(?<!\w)-\w+
In the same string, it only matches -to as expected but I don't want the - in the match information.
Is it possible to chain positive and negative lookbehinds so they happen in order?