refactor: simplify and document regexp

Closes #247