3 ms·
Frak [1] does something like that and was written with syntax higlighters in mind. [1]: https://github.com/noprompt/frak https://github.com/noprompt/frak edit
by hk__2 10y ago
Frak [1] does something like that and was written with syntax higlighters in mind.
[1]: https://github.com/noprompt/frak https://github.com/noprompt/frak
edit: typo
- Klathmon 10y agoWow that's almost exactly what I had in mind. I might take a look at this later and see if incorporating this or something like it has any kind of meaningful impact.
- jaytaylor 10y agoWow, this is an interesting idea for a library, thanks @hk__2 for sharing! TLDR; frak transforms collections of strings into regular expressions for matching those strings. It is available as a command line utility and for the browser as a JavaScript library.
- sooheon 10y agoI think emacs has the equivalent built in: `(rx (or "foo" "bar" "baz" "quux"))` gives you: `;; => "\\(?:ba[rz]\\|foo\\|quux\\)"`