\s* in the regex matches \n, so when ignoreip = is empty: ^ignoreip\s*=\s*(.+)$ → consumes the newline, captures [badbot] from the next section header as if it were an IP address. Fix: use [ \t]* instead of \s* so the regex never crosses a line boundary. Also tighten the addWhitelist line-finder to use the same pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>