regex() uses lastIndex to get flags when rewriting
regex() uses lastIndex to get flags when rewriting

For robustness, in case the lengths of .source and .toString() aren't
the same, for example things like \q aren't technically allowed in
regexes and the \ might be ignored or turned into \\.
https://github.com/jayferd/parsimmon/pull/10#issuecomment-31990031

jneen/parsimmon,edge/parsimmon,anko/partser,edge/parsimmon,claudiopro/parsimmon,claudiopro/parsimmon