I have this string pattern I'm trying to match. It can contain some words enclosed within two curly braces. These curly braces have to be well-formed and they cannot be nested.
For example:
I have this {{example}} which is right
Here {{is}} another {{example}} which is right
{{ This {{ example }} is wrong }}
{{ This }}example {{ is also { wrong }}
I have constructed this regex which seems to work but it is very long and I think it can be simplified.
"^([^{}]*\\{\\{([^{}]*)\\}\\}[^{}]*)+$"
Is there any way I can simplify this?