Rregex
Rust Regex binding for Javascript
Install / Use
/learn @2fd/RregexREADME
rregex
A dependency-free WebAssembly build of Rust Regex for Javascript
Why Rust Regex
Rust has a powerful Regex library with a lot of features that don't exists en the standard Regex object
See the official documentation for more detail
Install
# NPM
npm install rregex
# Yarn
yarn add rregex
# PNPM
pnpm add rregex
# Deno
deno add @rregex/rregex
# JSR
npx jsr add @rregex/rregex
Supported Runtimes
This package includes builds for multiple runtimes
| Runtime | Import | version |
| ------------------ | ------------------------------------------------------- | ---------- |
| Node.js (esm) | import { RRegex, RRegexSet } from 'rregex' | * |
| Node.js (commonjs) | const { RRegex, RRegexSet } = require('rregex') | * |
| Deno | import { RRegex, RRegexSet } from '@rregex/rregex' | >=1.10.8 |
| Bun | import { RRegex, RRegexSet } from '@rregex/rregex' | >=1.10.8 |
| Cloudflare Workers | import { RRegex, RRegexSet } from 'rregex/lib/cf.mjs' | >=1.10.8 |
| Browser | TODO | |
| Standalone | TODO | |
Benchmarks
In general terms rregex is at least 1 order of magnitud slower than the native RegExp object, but still have a good performance. Unless you required some of the features that rregex provides, you should always consider using the native RegExp object
Benchmarks are executed using test/deno.bench.mjs, and test/node.bench.mjs
| benchmark | time (avg) | iter/s | | --------- | -------------: | ------: | | RegExp | 342.91 µs/iter | 2,916.2 | | RRegex | 7.27 ms/iter | 137.6 |
summary:
RegExpis 21.19x faster thanRRegex
IP
| benchmark | time (avg) | iter/s | | --------- | ------------: | -------: | | RegExp | 72.63 µs/iter | 13,767.7 | | RRegex | 7.02 ms/iter | 142.5 |
summary:
RegExpis 96.59x faster thanRRegex
URI
| benchmark | time (avg) | iter/s | | --------- | -------------: | ----------: | | RegExp | 688.79 ns/iter | 1,451,825.0 | | RRegex | 22.52 ms/iter | 44.4 |
summary:
RegExpis 32689.42x faster thanRRegex
| benckmarks | benckmarks |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [
](https://jsbenchmark.com/#eyJjYXNlcyI6W3siaWQiOiJlZl9VbGJvYThpRGNYeGM3VUl4YnMiLCJjb2RlIjoiREFUQS5tYXRjaCgnKD86KD86MjVbMC01XXwyWzAtNF1bMC05XXxbMDFdP1swLTldWzAtOV0pXFxcXC4pezN9KD86MjVbMC01XXwyWzAtNF1bMC05XXxbMDFdP1swLTldWzAtOV0pJykiLCJkZXBlbmRlbmNpZXMiOltdLCJuYW1lIjoiUmVnRXhwOiBJUCJ9LHsiaWQiOiI0QkxuZmtPd0p4ZTZhQ0NSVmpIOVUiLCJjb2RlIjoibmV3IHJyZWdleC5SUmVnZXgoXCIoPzooPzoyNVswLTVdfDJbMC00XVswLTldfFswMV0_WzAtOV1bMC05XSlcXFxcLil7M30oPzoyNVswLTVdfDJbMC00XVswLTldfFswMV0_WzAtOV1bMC05XSlcIikuZmluZChEQVRBKSIsImRlcGVuZGVuY2llcyI6W10sIm5hbWUiOiJSUmVnZXg6IElQIn1dLCJjb25maWciOnsibmFtZSI6IlJSZWdleCB2cyBOYXRpdmU6IElQIiwicGFyYWxsZWwiOnRydWUsImdsb2JhbFRlc3RDb25maWciOnsiZGVwZW5kZW5jaWVzIjpbeyJ1cmwiOiJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL3JyZWdleEAxLjEwLjEwL2xpYi93ZWIubWluLmpzIiwibmFtZSI6InJyZWdleCIsImVzbSI6dHJ1ZX1dfSwiZGF0YUNvZGUiOiJjb25zdCB3cmVzID0gYXdhaXQgZmV0Y2goJ2h0dHBzOi8vY2RuLmpzZ
Related Skills
himalaya
345.4kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Writing Hookify Rules
104.6kThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
