Using TDFA instead of PRCE for performance. Changing some regex to comply with POSIX syntax.