Comment: you define first the basic elements (as for a lexer) with named groups
Definition Group(?(DEFINE)
(?<var> [a-z_]\w*)
(?<dqstr> (?<=") [^\\"]*+ (?s:\\.[^\\"]*)*+ (?=") )
(?<sqstr> (?<=') [^\\']*+ (?s:\\.[^\\']*)*+ (?=') )
(?<string> \g<dqstr> | \g<sqstr> )
(?<num> [0-9]+(?:\.[0-9]+)? )
(?<value> \g<string> | \g<num> )
(?<comp> [!><=]= | =?[><])
) Group var(?<var> [a-z_]\w*) a-zone character from a (9710) to z (12210) (case insensitive)
_the literal _ (9510 / 1378 / 5F16)
\w*any word character, repeated any number of times
Group dqstr(?<dqstr> (?<=") [^\\"]*+ (?s:\\.[^\\"]*)*+ (?=") ) Positive Lookbehind(?<=") "the literal " (3410 / 428 / 2216)
Negated Character Class[^\\"]*+ *+matches any number of characters outside the set below:
\\the literal \ (9210 / 1348 / 5C16)
"the literal " (3410 / 428 / 2216)
Group with flags gxis(?s:\\.[^\\"]*)*+ *+repeats the group contents below any number of times:
s modifier: single line. Allows a dot to match line terminators
\\the literal \ (9210 / 1348 / 5C16)
.any character
Negated Character Class[^\\"]* *matches any number of characters outside the set below:
\\the literal \ (9210 / 1348 / 5C16)
"the literal " (3410 / 428 / 2216)
"the literal " (3410 / 428 / 2216)
Group sqstr(?<sqstr> (?<=') [^\\']*+ (?s:\\.[^\\']*)*+ (?=') ) Positive Lookbehind(?<=') 'the literal ' (3910 / 478 / 2716)
Negated Character Class[^\\']*+ *+matches any number of characters outside the set below:
\\the literal \ (9210 / 1348 / 5C16)
'the literal ' (3910 / 478 / 2716)
Group with flags gxis(?s:\\.[^\\']*)*+ *+repeats the group contents below any number of times:
s modifier: single line. Allows a dot to match line terminators
\\the literal \ (9210 / 1348 / 5C16)
.any character
Negated Character Class[^\\']* *matches any number of characters outside the set below:
\\the literal \ (9210 / 1348 / 5C16)
'the literal ' (3910 / 478 / 2716)
'the literal ' (3910 / 478 / 2716)
Group string(?<string> \g<dqstr> | \g<sqstr> ) 1st Alternative \g<dqstr> \g<dqstr>calls group dqstr as a subroutine
2nd Alternative \g<sqstr> \g<sqstr>calls group sqstr as a subroutine
Group num(?<num> [0-9]+(?:\.[0-9]+)? ) +matches at least one character from the set below:
0-9one character from 0 (4810) to 9 (5710)
Non-Capturing Group(?:\.[0-9]+)? ?repeats the group contents below at most once:
\.the literal . (4610 / 568 / 2E16)
+matches at least one character from the set below:
0-9one character from 0 (4810) to 9 (5710)
Group value(?<value> \g<string> | \g<num> ) 1st Alternative \g<string> \g<string>calls group string as a subroutine
Group comp(?<comp> [!><=]= | =?[><]) Comment: Then you write the pattern using these named groups
(?J)applies the following effective flags to the remainder of the pattern: gxiJ Comment: allow duplicate named groups
Comment: variable op value
Group key(?<key> \g<var> ) \h*any horizontal whitespace character, repeated any number of times
\g<comp>calls group comp as a subroutine
\h*any horizontal whitespace character, repeated any number of times
Group val(?<val> \g<value>)