Definition Group(?(DEFINE)(?<optionalSpace_H>(?:\h*)?)) Group optionalSpace_H(?<optionalSpace_H>(?:\h*)?) Non-Capturing Group(?:\h*)? ?repeats the group contents below at most once:
\h*any horizontal whitespace character, repeated any number of times
Definition Group(?(DEFINE)(?<optionalSpace_HV>(?:(?:\h|\R)*)?)) Group optionalSpace_HV(?<optionalSpace_HV>(?:(?:\h|\R)*)?) Non-Capturing Group(?:(?:\h|\R)*)? ?repeats the group contents below at most once:
Non-Capturing Group(?:\h|\R)* *repeats the group contents below any number of times:
\hany horizontal whitespace character
^start of line
(?P>optionalSpace_H)calls group optionalSpace_H as a subroutine
Comment: 'function', if it exists. Bash requires
Comment: no newline after this
Non-Capturing Group(?:function(?P>optionalSpace_H))? ?repeats the group contents below at most once:
functionthe literal text function (case sensitive) (?P>optionalSpace_H)calls group optionalSpace_H as a subroutine
Comment: Bash allows -, :, and . in function identifiers, even if
Comment: it is not specified in POSIX
Group functionIdentifier(?<functionIdentifier>(?:\w|-|:|\.)*) Non-Capturing Group(?:\w|-|:|\.)* *repeats the group contents below any number of times:
-the literal - (4510 / 558 / 2D16)
:the literal : (5810 / 728 / 3A16)
\.the literal . (4610 / 568 / 2E16)
Comment: (?=(?P>optionalSpace_HV)(?:{|\())?
Comment: Gobble up any ()
Non-Capturing Group(?:(?P>optionalSpace_H)\((?P>optionalSpace_H)\)(?P>optionalSpace_H))? ?repeats the group contents below at most once:
(?P>optionalSpace_H)calls group optionalSpace_H as a subroutine
\(the literal ( (4010 / 508 / 2816)
(?P>optionalSpace_H)calls group optionalSpace_H as a subroutine
\)the literal ) (4110 / 518 / 2916)
(?P>optionalSpace_H)calls group optionalSpace_H as a subroutine
Comment: Start the function
Comment: (\(|{)
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
x modifier: extended. Ignores unescaped whitespace and comments outside character classes