3 ms·
Emacs has something similar, for generating compressed matchers from examples you provide. Though this operates on a closed-world principle: the result will mat
by TeMPOraL 6y ago
Emacs has something similar, for generating compressed matchers from examples you provide. Though this operates on a closed-world principle: the result will match your examples, but only your examples.
ELISP> (message (regexp-opt '("0x12" "0x13" "0x2f" "0x1d" "0xcc")))
"\\(?:0x\\(?:1[23d]\\|2f\\|cc\\)\\)"
(in *Messages* buffer)
\(?:0x\(?:1[23d]\|2f\|cc\)\)
(Note that Emacs' regex syntax is slightly different than PCRE.)