Regex+ 6.1.0 released. Adds even cleaner and more robust interpolation of RegExp instances and partial patterns. And improved docs. 😀 github.com/slevithan/re...
Steven Levithan
Steven Levithan
@slev.life
Creator → Regex+, Oniguruma-To-ES, xregexp.com, regex.cool Coauthor → Regular Expressions Cookbook, High Performance JavaScript slev.life
216 followers16 following60 posts
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
Neither @antfu.me nor I thought this was possible when we started down this road. But it's finally done 😁
Congrats to @slev.life who did the hard work and made @shiki.style's JS engine compatible with 100% of the built-in languages! github.com/shikijs/shik...
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...
Thanks so much @brc-dd.dev for the generous sponsorship!! Appreciate all the great work you do for VitePress and open source!
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...
🚢 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 :)
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...
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...
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...
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...
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...
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...
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!
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 ⚡🚀
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...
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
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 😊
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...
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...
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...
What do you think github.com/slevithan/re... is missing that would make it easier to use or make regexes in JavaScript better?
Steven Levithan reposted
In 2024, we have redistributed a total of $4,371.83 USD to the open-source community! Thanks to everyone who supported this idea! 💖 Here is the recap: opencollective.com/antfu/update...
If you want to know what I think the JS regex mistakes are: x.com/slevithan/st...
The biggest improvement most people can make to their mastery of regex is usually not learning more advanced features, but truly understanding *backtracking* This short article of mine from 2007 illustrates in depth the mechanics of regex backtracking: blog.stevenlevithan.com/archives/gre...
The path to supporting 100% of TextMate grammars in @shiki.style's JS engine: github.com/shikijs/shik...
.@shiki.style's JS engine has continually improved since being introduced in v1.15. As of the just-launched v1.24.4, it's no longer experimental! 🎉 The JS engine allows dropping the large Oniguruma WASM dependency while still sharing the same syntax highlighting grammars used by VS Code, GitHub, etc
Grammar list for the JS engine: < shiki.style/references/e... >. Nearly complete, and will continue to improve.
🎉 oniguruma-to-es 0.8.0 released, adding another large chunk of hard-fought grammars to @shiki.style's supported list when using its lightweight JS engine (which is < 4% of the size of the WASM regex engine). 95% of all grammars (> 99.9% of all regexes) now supported. github.com/slevithan/on...
Longtime fan of @dr-axel.de's books and work. Welcome to 🦋
My books on #JavaScript and #TypeScript are free to read online: – Exploring JavaScript (ES2024 edition) – Deep JavaScript – Tackling TypeScript – Shell scripting with Node.js 🦋 Reposts appreciated! exploringjs.com
Thanks for the sponsorship! 🙏
💖 For this November, we redistributed our funds to @slev.life, Color.js @lea.verou.me, MSW @kettanaito.com, @esm.sh, @pnpm.bsky.social, Iconify @cyberalien.dev for their amazing work on Open Source! 🙏 Thanks to all the sponsors for making this possible! opencollective.com/antfu/update...
The JS engine for @shiki.style improves yet again with the latest version of oniguruma-to-es: github.com/shikijs/shik... (+1 grammar supported, and improved perf for most grammars)
Just released Oniguruma-To-ES v0.4.0! github.com/slevithan/on... It includes a breakthrough that will increase @shiki.style's grammar support for its JS engine from 85% of grammars to 92%. This is after v0.1.2 of my lib bumped Shiki's coverage to 85% 2 days ago 😂
Steven Levithan reposted
🌈 Shiki v1.23 just dropped with massive updates: - New JavaScript engine by @slev.life that supports more languages - New Colorized Brackets package by michaelmakes.games - FS-based Twoslash cache by @nakasyou.bsky.social - New Style-to-Class transformer 👇 github.com/shikijs/shik...
Oniguruma-To-ES v0.3.0 now supports the vast majority of ways that recursion is used, including indirect recursion and multiple recursions in the same pattern — further increasing the number of supported grammars when used with Shiki syntax highlighter. github.com/slevithan/on... cc @antfu.me
Regex+ (formerly `regex`) recently crossed 500 ⭐s, 500K mo. dls, and 5 mo. since initial release (19 releases). 🎉 This is the regex library I've wanted since ES6 added tagged templates. Try it out -- I think you'll find the "regexes are unreadable" reputation is outdated. github.com/slevithan/re...
Uplevel your regex-fu with my deep dive into JS regex history on Smashing Magazine. www.smashingmagazine.com/2024/08/hist... Lots of new and powerful regex features you might have missed from recent versions of JavaScript!
PS @mths.be played a huge role in getting a lot of these new features into the JS standards #regexhero 🦸🏼♂️