3 ms·
> For the fallback mechanism to kick in, the RegExp must: > * ... > * not have the u (Unicode) or i (case insensitive) flags set. I wonder why these flags ar
by recursive 6y ago
> For the fallback mechanism to kick in, the RegExp must:
> * ...
> * not have the u (Unicode) or i (case insensitive) flags set.
I wonder why these flags are significant. Case-insensitivity and unicode support don't seem like they should really affect whatever algorithm they're using.
Am I underthinking this, or can you convert /abc/i into /[aA][bB][cC]/ ?
- eyelidlessness 6y agoI think for the ASCII/Latin characters you selected you’re probably right, but the moment you’re matching Unicode explicitly or characters in the Unicode range implicitly (JS strings are always Unicode), those substitutions may become more complex and deoptimize (or just require additional engineering effort).
- boulos 6y agoJust seems like implementation work. See the various TODOs from mbid like https://github.com/v8/v8/blob/dc712da548c7fb433caed56af9a021d964952728/src/regexp/experimental/experimental-compiler.cc#L34 https://github.com/v8/v8/blob/dc712da548c7fb433caed56af9a021...
- danielheath 6y agoCurrent locale determines what the case equivalence rules are for many characters.