I have a config file that the user can specify sections, and then within those section they can specify regular expressions. I have to parse this config file and separate the regex’s into the various sections.
Is there an easy way to delimitate a regex from a section header? I was thinking just the standard
[section] regex1 regex2
But I just realized that [section] is a valid regex. So I’m wondering if there’s a way I can format a section header so that it can ONLY be understood as a section header and not a regex.
There’s an unlimited ways of making an invalid regexp, but the first thing that comes to mind would be
You can’t have a quantifier (
*) at the start of the regexp.(The other
*is there just to satisfy my obsession for symmetry.)