I'll try to make this short and easy since I am having a hard time trying to put into words what exactly it is I am trying to do.
Basically I am trying to match tokens inside tokens or the entire token. The regex I have below works except for when there is a random {
that isn't part of a token.
Example:
Tokens start with "{:" and end with ":}"
{:MyTokenFunction({:MyTokenParameter:}):}
^--- WORKS as it matches "{:MyTokenParameter:}"
{:MyTokenFunction(5):}
^--- WORKS as it matches "{:MyTokenFunction(5):}"
{:MyTokenFunction(random{string}):}
^--- The "{" causes no matches, but should match the entire string.
Here's a colored example of what the regex I have matches on. *the first 2 examples are correct, but the 3rd example should match entirely and it doesn't at all.
Here's the regex I am currently using which is having issues with the third example:
\{\:[^\{]+?\:\}
For the life of me I cannot figure out how to get around the {
causing 0 matches.
I tried to use lookbehinds/aheads, but I wasn't having much luck. Although I would of course love a quick answer; I would love an explanation of what the regex is actually doing more. I have done a lot of searching to try and figure this out, but was unable to find a good example due to the fact that my "tokens" are wrapped by multiple characters and start/end aren't the same.
Thanks