# Section header
the literal text # Section header↵ (case sensitive) ^start of line
the literal (3210 / 408 / 2016)
\s*any whitespace character, repeated any number of times
the literal (3210 / 408 / 2016)
\[the literal [ (9110 / 1338 / 5B16)
the literal (3210 / 408 / 2016)
\s*any whitespace character, repeated any number of times
the literal (3210 / 408 / 2016)
\w+any word character, repeated at least once
the literal (3210 / 408 / 2016)
\s*any whitespace character, repeated any number of times
the literal (3210 / 408 / 2016)
\]the literal ] (9310 / 1358 / 5D16)
the literal (3210 / 408 / 2016)
\s*any whitespace character, repeated any number of times
the literal (3210 / 408 / 2016)
$end of line
# Section items
the literal text ↵↵# Section items↵ (case sensitive) Non-Capturing Group(?:
^ (?:
# key = value
\s* \w+ \s* = \s* [\w\s]+ \s*
|
# comment line
\s* \# .* $
|
# blank line
\s*
) $
) ^start of line
the literal (3210 / 408 / 2016)
Non-Capturing Group(?:
# key = value
\s* \w+ \s* = \s* [\w\s]+ \s*
|
# comment line
\s* \# .* $
|
# blank line
\s*
) 1st Alternative
# key = value
\s* \w+ \s* = \s* [\w\s]+ \s*
# key = value
the literal text ↵ # key = value↵ (case sensitive) \s*any whitespace character, repeated any number of times
the literal (3210 / 408 / 2016)
\w+any word character, repeated at least once
the literal (3210 / 408 / 2016)
\s*any whitespace character, repeated any number of times
\s*any whitespace character, repeated any number of times
the literal (3210 / 408 / 2016)
+matches at least one character from the set below:
\wany word character
\sany whitespace character
the literal (3210 / 408 / 2016)
\s*any whitespace character, repeated any number of times
2nd Alternative
# comment line
\s* \# .* $
# comment line
the literal text ↵ # comment line↵ (case sensitive) \s*any whitespace character, repeated any number of times
the literal (3210 / 408 / 2016)
\#the literal # (3510 / 438 / 2316)
the literal (3210 / 408 / 2016)
.*any character (except for line terminators), repeated any number of times
the literal (3210 / 408 / 2016)
$end of line
3rd Alternative
# blank line
\s*
# blank line
the literal text ↵ # blank line↵ (case sensitive) \s*any whitespace character, repeated any number of times
the literal (3210 / 408 / 2016)
$end of line
the literal ↵ (1010 / 128 / A16)
*the literal (3210 / 408 / 2016) , repeated any number of times
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