if a pattern contains unicode classes like \w, \s \d, always compile with /u.
if the subject is ascii, compile again with /a and do the ascii match.
otherwise if the pattern is compiled /a and the subject is /u, re-compile again.
cache the optional second pattern. in pprivate as struct of compiled_ascii_pattern and compiled_uni_pattern, together with the engine. see e.g. re::engine::Hyperscan where I also store two ptrs in pprivate.
also cache statistics about asc/uni usage to make better predictions. (e.g. 2 more ints)
if the pattern is not UTF8 (but ambivalent with \D\W...) but the subject is, recompile with UTF and match.
failing re_tests: