Steven Levithan
slev.life
Steven Levithan
@slev.life
Creator → Regex+, Oniguruma-To-ES, xregexp.com, regex.cool
Coauthor → Regular Expressions Cookbook, High Performance JavaScript
slev.life
Neither @antfu.me nor I thought this was possible when we started down this road. But it's finally done 😁
August 2, 2025 at 4:57 PM
Great tips
June 27, 2025 at 5:16 PM
The latest version of Regex Colorizer (a project I started in 2007) is finally available via npm, after getting the package name transferred to me 😊 github.com/slevithan/re...
GitHub - slevithan/regex-colorizer: 🎨 Highlighter for JavaScript regex syntax
🎨 Highlighter for JavaScript regex syntax. Contribute to slevithan/regex-colorizer development by creating an account on GitHub.
github.com
May 7, 2025 at 10:57 AM
Thanks so much @brc-dd.dev for the generous sponsorship!! Appreciate all the great work you do for VitePress and open source!
May 4, 2025 at 12:15 AM
Improved the docs for regex-recursion, highlighting standalone usage (without Regex+). Less than 2 kB for recursive regex matching with support for all ES2025 regex syntax. github.com/slevithan/re...
GitHub - slevithan/regex-recursion: Recursive regex matching in JavaScript. Official Regex+ plugin.
Recursive regex matching in JavaScript. Official Regex+ plugin. - slevithan/regex-recursion
github.com
May 3, 2025 at 11:46 AM
🚢 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 :)
April 21, 2025 at 6:08 PM
Regular expressions should not change the length of a match based on case insensitivity. My case for a breaking change in Oniguruma: github.com/kkos/oniguru...
Don't expand character match length with flag `i` (unless using a new flag) · Issue #351 · kkos/oniguruma
Currently, Oniguruma sometimes applies Unicode's SpecialCasing.txt rules when using flag i, which can lengthen the match of a character, character class, or set (like \w or \S). For example, (?i)^ß...
github.com
April 19, 2025 at 2:27 PM
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
April 13, 2025 at 7:39 PM
oniguruma-parser v0.10.0 brings a bunch of quality of life improvements. 🚀 The regex optimizer it includes, which is probably the most interesting part for people who don't regularly use Oniguruma, has continued to improve! github.com/slevithan/on...
April 11, 2025 at 2:12 AM
Any React Native devs, can you help me by testing whether Regex+ works at all in RN 0.75.1+ or RN 0.74.6+? 🙏🏻😌 Related issue: github.com/slevithan/re...
April 6, 2025 at 11:08 AM
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.
April 5, 2025 at 10:31 PM
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...
March 27, 2025 at 12:14 AM
Request to run VS Code's syntax highlighting grammars through my Oniguruma regex optimizer (like Shiki does), which would improve highlighting performance for some languages like C++ and reduce the size of VS Code: github.com/microsoft/vs...
Pre-optimize TM grammars for performance and reduced bundle size · Issue #243405 · microsoft/vscode
TextMate grammars used for syntax highlighting can individually contain thousands of regexes and are, collectively, quite large. Their regexes can be optimized via minification that also improves t...
github.com
March 13, 2025 at 12:17 AM
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
March 11, 2025 at 9:45 AM
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!
March 11, 2025 at 3:05 AM
Adding my new regex optimizer to @shiki.style: github.com/shikijs/text... - It shaves more than 35,000 chars off just the C++ grammar (as an example) compared to the prior minification (without any change in meaning), and makes some of its regexes significantly faster ⚡🚀
feat: use oniguruma-parser/optimizer for all grammars by slevithan · Pull Request #133 · shikijs/textmate-grammars-themes
Closes #125. Introduces a fancy Oniguruma regex optimizer that not only minifies more robustly (e.g., C++ drops more than 35,000 characters compared to the existing minification), but also improves...
github.com
March 9, 2025 at 7:41 PM
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 🚀
March 6, 2025 at 10:21 PM
Lots of improvements released for my new Oniguruma optimizer (minifies regexes and improves their perf), plus added a new demo page: github.com/slevithan/on...
github.com
March 5, 2025 at 8:59 PM
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
March 3, 2025 at 7:12 PM
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
February 4, 2025 at 3:19 AM
Using Oniguruma → JavaScript regex transpilation in VS Code for syntax highlighting is getting community support: github.com/microsoft/vs... Add a thumbs up on the issue if you think it's a good idea 😊
January 23, 2025 at 12:03 AM
Here's the same exact thing but readable/maintainable, using Regex+ (can be minified to a regex literal using its Babel plugin).
January 22, 2025 at 1:13 AM
oniguruma-to-es hits a big milestone with v2.0 by comprehensively supporting the extremely flexible \G anchor (which has no direct equivalent in JS regexes). See github.com/slevithan/on...
January 14, 2025 at 10:39 PM
Ever wondered why there aren't good tools for converting between different regex flavors automatically?
Would you use a universal regex translator in your own projects?
Want to help build one?
github.com/slevithan/on...
Ideas for creating a universal regex translator · Issue #27 · slevithan/oniguruma-to-es
This project (oniguruma-to-es) and it's high complexity demonstrates that accurately/comprehensively converting between any two regex flavors is a hard task, and not for the faint of heart. (Though...
github.com
January 9, 2025 at 7:30 PM
oniguruma-to-es v1.0.0 is out! ✨ The new release includes lots of edge case fixes reported by Oniguruma expert RedCMD, making its emulation even more accurate 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
January 8, 2025 at 3:23 PM