Documentation for regex
|| assembled from the following types:
To match one of several possible alternatives, separate them by
||; the first matching alternative wins.
ini files have the following form:
[section]key = value
Hence, if you parse a single line of an
ini file, it can be either a section or a key-value pair and the regex would be (to a first approximation):
/ '[' \w+ ']' || \S+ \s* '=' \s* \S* /
That is, either a word surrounded by square brackets, or a string of non-whitespace characters, followed by zero or more spaces, followed by the equals sign
=, followed again by optional whitespace, followed by another string of non-whitespace characters.
Even in non-backtracking contexts, the alternation operator
|| tries all the branches in order until the first one matches.