Fix #997: Limited support for in-pattern regex flags.
Merge pull request #1019 from gzm0/in-regex-flags

Fix #997: Limited support for in-pattern regex flags.