I have the following regexp:
/(?:[\\[\\{]*)(?:([A-G\\-][^A-G\\]\\}]*)+)(?:[\\]\\}]*)/
with the following expression:
{A\'\'
You can get it with this pattern with preg_match_all
at the item 0:
~
(?:
\G (?!\A) # contiguous to previous match, but not at the start of the string
|
{ (?=[^}]* }) # start with { and check if a closing bracket follows
|
\[ (?=[^]]* ]) # the same for square bracket
)
\K # start the match result here
[A-G] [^]A-G}]*
~xS
demo