Group 1([a-zA-Z_]\w+|[a-zA-Z]\w*|\[\s*[a-zA-Z_]\w+\s*\]|\[\s*[a-zA-Z]\w*\s*\]) 1st Alternative[a-zA-Z_]\w+ a-zone character from a (9710) to z (12210) (case sensitive)
A-Zone character from A (6510) to Z (9010) (case sensitive)
_the literal _ (9510 / 1378 / 5F16)
\w+any word character, repeated at least once
2nd Alternative[a-zA-Z]\w* a-zone character from a (9710) to z (12210) (case sensitive)
A-Zone character from A (6510) to Z (9010) (case sensitive)
\w*any word character, repeated any number of times
3rd Alternative\[\s*[a-zA-Z_]\w+\s*\] \[the literal [ (9110 / 1338 / 5B16)
\s*any whitespace character, repeated any number of times
a-zone character from a (9710) to z (12210) (case sensitive)
A-Zone character from A (6510) to Z (9010) (case sensitive)
_the literal _ (9510 / 1378 / 5F16)
\w+any word character, repeated at least once
\s*any whitespace character, repeated any number of times
\]the literal ] (9310 / 1358 / 5D16)
4th Alternative\[\s*[a-zA-Z]\w*\s*\] \[the literal [ (9110 / 1338 / 5B16)
\s*any whitespace character, repeated any number of times
a-zone character from a (9710) to z (12210) (case sensitive)
A-Zone character from A (6510) to Z (9010) (case sensitive)
\w*any word character, repeated any number of times
\s*any whitespace character, repeated any number of times
\]the literal ] (9310 / 1358 / 5D16)
\s*any whitespace character, repeated any number of times
\[the literal [ (9110 / 1338 / 5B16)
\s*any whitespace character, repeated any number of times
'the literal ' (3910 / 478 / 2716)
"the literal " (3410 / 428 / 2216)
Group 2([a-zA-Z_]\w+|[a-zA-Z]\w*) 1st Alternative[a-zA-Z_]\w+ a-zone character from a (9710) to z (12210) (case sensitive)
A-Zone character from A (6510) to Z (9010) (case sensitive)
_the literal _ (9510 / 1378 / 5F16)
\w+any word character, repeated at least once
2nd Alternative[a-zA-Z]\w* a-zone character from a (9710) to z (12210) (case sensitive)
A-Zone character from A (6510) to Z (9010) (case sensitive)
\w*any word character, repeated any number of times
'the literal ' (3910 / 478 / 2716)
"the literal " (3410 / 428 / 2216)
\s*any whitespace character, repeated any number of times
\]the literal ] (9310 / 1358 / 5D16)
g modifier: global. Finds all matches instead of stopping after the first
m modifier: multiline. Causes ^ and $ to match the start and end of each line, not only the start and end of the string