I'm trying to match a part of a string between two different tokens. They might be multiple occurrences of the tokens in a string.
Sample text (tokens are italic, text to match is bold):
This is [begin-match] a sample text [end-match] with some [begin-match] tokens and normal [end-match] text.
I have the following regex, which would work if the tokens were { and }:
/{([^}]+)}/g
I can't get this to work the [begin-match] and [end-match] tokens. It seems that the lack of negative lookbehind in Javascript is a big loss.
I can't figure out how to substitute the { and } for the tokens [begin-match] and [end-match]. How can I match on those?