add unicode flag support to regex
Only apply kludge from f48503cd31826f8cfb0f0e2b6964879dbe318385 when unicode regexps are not supported