Steven Levithan

@slev.life

Creator → Regex+, Oniguruma-To-ES, xregexp.com, regex.cool Coauthor → Regular Expressions Cookbook, High Performance JavaScript slev.life

Oniguruma-To-ES now has 12M dl/m. Most of that comes from Shiki, which uses it to make VSCode-style syntax highlighting possible in native JS (no large WASM). I like to think it's contributing to Shiki's rapid growth :) Recent example is in Vercel's streamdown.ai

🚢 Released emoji-regex-xs v2.0. Now matches all underqualified emoji included in Unicode's emoji-test.txt list, to better match @mths.be's excellent emoji-regex and real-world emoji use. Lib size reduced from 0.3 to 0.2 kB in the process :)

oniguruma-to-es v4.2.0 shipped! 🚢 Continues improving by far the most sophisticated regex translator in the world. JS coders who've never used Oniguruma might still find it useful if they want much more feature-rich regexes (with native perf!) github.com/slevithan/on...

GitHub - slevithan/oniguruma-to-es: Convert patterns from Oniguruma (the regex engine used by Ruby, TextMate grammars, etc.) to native JavaScript RegExp

Convert patterns from Oniguruma (the regex engine used by Ruby, TextMate grammars, etc.) to native JavaScript RegExp - slevithan/oniguruma-to-es

github.com

Migrated a bunch of tests from Jasmine to Vitest so I could use TypeScript more easily. Super nice! ⚡ Will be trying to use Vitest everywhere from now on.

Over the last week and with major help from RedCMD, we converted all of oniguruma-parser from JS to TS. 🎉 Surprised that all of this work uncovered 0 bugs (despite the high complexity of the migrated code), which I think speaks to the pre-existing high quality of the lib. github.com/slevithan/on...

Just shipped version 0.6 of oniguruma-parser, which includes a new optimization that is able to automatically identify and fix some ReDoS vulnerabilities without changing what the regex matches. It already identified one such regex in the Haskell grammar used by @shiki.style

Although it's not in the release notes, @shiki.style 3.2.0 includes slight-to-major performance improvements for many languages (for both the Oniguruma and JS engines), thanks to the new regex optimizer from `oniguruma-parser`. Worth upgrading!

More oniguruma-parser updates! An example of what it's optimizer/minifier can do, in the image. Some transforms can significantly improve perf for complex regexes 🚀

Bild

New launch! `oniguruma-parser` extracts the parser/traverser from my Oniguruma-To-ES transpiler, makes a ton of improvements, and adds new code generator and optimizer modules: github.com/slevithan/on... Great for TextMate grammar authors and anyone who works with Oniguruma regexes

oniguruma-parser/src/optimizer at main · slevithan/oniguruma-parser

Parse Oniguruma regular expressions. Contribute to slevithan/oniguruma-parser development by creating an account on GitHub.

github.com

Oniguruma-To-ES v3.1.0 includes a new feature I think is new in JS: Lazy construction of RegExp objects, deferred until first use in a search (with nothing observably different before/after). Also allows lazy-compile based on pattern length, since only very long patterns are slow to construct in V8

JavaScript regexes got most things right (and are better with flag u/v), but there were a handful of deep mistakes in behavior/API (some inherited but mostly breaks from prior art in Perl, etc.). After deep-diving into Oniguruma edge cases… good god, it could have been much worse