refactor: better error handling in the regex parser; and also track and output the position offset in the regex string when a syntax error happens.