Is there a way to use the Unicode tables in the Rust regex crate to match a single char without turning it into a String or &str? It seems like the internals must have a way to do this, but perhaps not exposed? Is there a trick?
More generally, internals do not actually have a direct way to do this, since char classes are matched differently depending on engine. For DFA, classes compile down to UTF-8 automata. For NFA, classes are binary searched: https://github.com/rust-lang/regex/blob/2b1fc2772dc4d99ad732a43751fb5627f327abc8/src/prog.rs#L370 …
-
-
And if you have utf-8 and your character is ascii, just look for the character as a byte. Magic of utf-8.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.