I've written the following line of code:
XRegExp.exec(data, XRegExp('<!-- @\[(?<component>[\w+])[\(*(?<classes>[\w+])*\)]*\] -->', 'g'))
As you can see it is using the XRegExp library so I can use named groups other PCRE features.
I'm getting the error:
syntaxError: Invalid regular expression: /<!-- @[(?<component>[w+])[(*(?<classes>[w+])*)]*] -->/: Unmatched ')'
However, I don't understand where the unmatched
) is. As far as I can tell, all brackets that need to be escaped should be and all the ones that shouldn't are not.
Here is the string I am trying to match:
<!-- @[NoteBlock(warning)] -->
these should also match:
<!-- @[NoteBlock(warning, high-level)] -->
<!-- @[NoteBlock] -->
This should not match:
<!-- @[(warning, high-level)] -->