I\'m trying to create simmiliar parser like smarty. For very small parts of code, and don\'t want to implement huge smarty-like parser.
What I came up with is:
(?:
You need to use branch reset groups:
(?|([a-zA-Z0-9]+)=(?|([^\v '"]+)|"(.*?)"|'(.*?)')|([a-zA-Z0-9]+))
^ ^
See the regex demo.
From the reference:
Alternatives inside a branch reset group share the same capturing groups. The syntax is
(?|regex)
where(?|
opens the group and regex is any regular expression. If you don't use any alternation or capturing groups inside the branch reset group, then its special function doesn't come into play. It then acts as a non-capturing group.