I'm trying to match a group that only matches when the first non-spacing character preceding the match is NOT an alphanumeric character.
RegExp i've tried, consuming the spaces first with \s* then looking behind to check for \w:
(?<!\w)\s*\({\w+}\)
Success
Input: this will = ({match})
Expected: ({match})
Actual: ({match})
Failure, still matches while preceded by alphanumeric (ignoring spaces)
Input: this should = not ({match})
Expected: -
Actual: ({match})
Using \s+ instead of \s* solved it partially but now it requires at least one space which is not desired!
(?<!\w)\s+\({\w+}\)
I've been looking around the internet but cannot solve the problem. Anyone?