?+repeats the group contents below at most once:
,the literal , (4410 / 548 / 2C16)
\s*any whitespace character, repeated any number of times
(*SKIP)acts like (*PRUNE), but the next unanchored match attempt starts where (*SKIP) was reached instead of at the next subject character
Comment: Attempts to match a comma and advanced whitespaces,
Comment: without backtracking;
Comment: And if the comma is matched, use (*SKIP) verb,
Comment: which advances the pointer if we fail to match the comma.
Comment: Key - Value pairs not worthy of keeping.
Group 2(
"(?!jobID"|exec)[^"]+" # Check if we like this key.
\s*+:\s*+ # The colon, advance whitespaces.
( # Check keys recursively.
"[^"]*"
# String literals, boring.
| {(?2)?+(?>,\s*(?2))*}
# Or: An object storing some key-value pairs
# we don't care about.
| \[(?3)?+(?>,\s*(?3))*\]
# Or: An array storing some values
# we don't care about.
)
)
"the literal text "
Negative Lookahead(?!jobID"|exec) jobID"the literal text jobID" (case sensitive) execthe literal text exec (case sensitive) Negated Character Class[^"]+ +matches at least one character outside the set below:
"the literal " (3410 / 428 / 2216)
Comment: Check if we like this key.
\s*+any whitespace character, repeated any number of times
:the literal : (5810 / 728 / 3A16)
\s*+any whitespace character, repeated any number of times
Comment: The colon, advance whitespaces.
Group 3( # Check keys recursively.
"[^"]*"
# String literals, boring.
| {(?2)?+(?>,\s*(?2))*}
# Or: An object storing some key-value pairs
# we don't care about.
| \[(?3)?+(?>,\s*(?3))*\]
# Or: An array storing some values
# we don't care about.
) 1st Alternative # Check keys recursively.
"[^"]*"
# String literals, boring.
Comment: Check keys recursively.
"the literal text "
Negated Character Class[^"]* *matches any number of characters outside the set below:
"the literal " (3410 / 428 / 2216)
Comment: String literals, boring.
2nd Alternative {(?2)?+(?>,\s*(?2))*}
# Or: An object storing some key-value pairs
# we don't care about.
(?2)?+optionally calls group 2 as a subroutine
Atomic Group(?>,\s*(?2))* *repeats the group contents below any number of times:
,the literal , (4410 / 548 / 2C16)
\s*any whitespace character, repeated any number of times
(?2)calls group 2 as a subroutine
Comment: Or: An object storing some key-value pairs
Comment: we don't care about.
3rd Alternative \[(?3)?+(?>,\s*(?3))*\]
# Or: An array storing some values
# we don't care about.
\[the literal [ (9110 / 1338 / 5B16)
(?3)?+optionally calls group 3 as a subroutine
Atomic Group(?>,\s*(?3))* *repeats the group contents below any number of times:
,the literal , (4410 / 548 / 2C16)
\s*any whitespace character, repeated any number of times
(?3)calls group 3 as a subroutine
\]the literal ] (9310 / 1358 / 5D16)
Comment: Or: An array storing some values
Comment: we don't care about.
Uses the first branch if group 1 matched
If the condition is true, match this branch: — matches an empty string
Otherwise, match this branch:,? ,?optionally matches the literal , (4410 / 548 / 2C16)
Comment: Balance the comma (so the result string is still valid JSON)
g modifier: global. Finds all matches instead of stopping after the first
x modifier: extended. Ignores unescaped whitespace and comments outside character classes