Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Regex
  3. Oniguruma-To-ES

Oniguruma-To-ES

MITJavaScriptv4.3.6

Translates Oniguruma regex patterns (used by Ruby, TextMate, VS Code) to native JavaScript RegExp with high accuracy.

Visit WebsiteGitHubGitHub
148 stars6 forks0 contributors

What is Oniguruma-To-ES?

Oniguruma-To-ES is a JavaScript library that translates Oniguruma regular expression patterns into native JavaScript RegExp. It solves the problem of using regexes written for Ruby, TextMate grammars (like those in VS Code and Shiki), or PHP in JavaScript environments, bridging syntax and behavioral gaps between the engines.

Target Audience

Developers working with TextMate grammars for syntax highlighting, those sharing regexes between Ruby/PHP and JavaScript codebases, and anyone needing to run Oniguruma-style regexes in JavaScript with high accuracy.

Value Proposition

It provides near-perfect translation fidelity for real-world Oniguruma regexes, often outperforms WASM-based alternatives in speed and bundle size, and supports modern JavaScript targets with advanced emulation features unavailable in other translators.

Overview

👹 Convert patterns from Oniguruma (the regex flavor used by Ruby, TextMate grammars, etc.) to native JavaScript RegExp

Use Cases

Best For

  • Converting TextMate grammar regexes for use in JavaScript syntax highlighters like Shiki
  • Sharing regex patterns between Ruby/Rails and JavaScript/Node.js applications
  • Running Oniguruma regexes from PHP's mb_ereg functions in JavaScript environments
  • Utilizing Oniguruma's extended features (e.g., atomic groups, recursion) in JavaScript projects
  • Improving performance over vscode-oniguruma WASM for regex matching in browsers
  • Precompiling regexes to minimize bundle size in frontend tooling

Not Ideal For

  • Projects requiring emulation of overlapping recursions or named callouts, which are explicitly unsupported per the README
  • Environments locked to JavaScript versions older than ES2018, as features like character class intersection require ES2024+ targets
  • Teams that prioritize drop-in WASM solutions over transpilation, especially if absolute feature parity for all Oniguruma features is critical
  • Use cases relying heavily on Unicode blocks (with the 'In' prefix), which are omitted to keep the library lightweight

Pros & Cons

Pros

High-Fidelity Translation

Supports ~99.99% of real-world Oniguruma regexes, accurately handling hundreds of syntax and behavioral differences, as tested on tens of thousands of TextMate grammar patterns.

Performance and Size

Generated regexes run as native JavaScript, often faster than WASM-based alternatives like vscode-oniguruma, with a bundle size ~4% of it, reducing browser load times.

Modern JavaScript Support

Outputs regexes compatible with ES2018, ES2024, or ES2025 targets, leveraging features like flag 'v' and flag groups for cleaner, more efficient patterns.

Advanced Feature Emulation

Accurately emulates complex Oniguruma features like atomic groups, possessive quantifiers, and recursion with identical behavior, even in extreme edge cases.

Precompilation Optimization

Allows precompiling regexes to eliminate runtime dependencies, and the tree-shakable EmulatedRegExp subclass minimizes bundle size for advanced features.

Cons

Unsupported Rare Features

A few extremely rare Oniguruma features, such as overlapping recursions and named callouts, are not supported and throw errors, though they affect less than 0.01% of real-world regexes.

EmulatedRegExp Subclass Dependency

Advanced emulation requires the EmulatedRegExp RegExp subclass, which can complicate integration with code expecting native RegExp objects and may not be fully compatible in all environments.

JavaScript Version Limitations

Full feature support, like character class intersection, requires ES2024 or later, restricting use in older environments without upgrades or workarounds.

Configuration Complexity

Numerous options like accuracy, target, and rules can be overwhelming for simple conversions and require careful tuning to avoid errors or suboptimal results.

Open Source Alternative To

Oniguruma-To-ES is an open-source alternative to the following products:

v
vscode-oniguruma

Oniguruma is a regular expression library used by Visual Studio Code for syntax highlighting and text matching, often integrated as a dependency rather than a standalone product.

Frequently Asked Questions

Quick Stats

Stars148
Forks6
Contributors0
Open Issues3
Last commit3 months ago
CreatedSince 2024

Tags

#regex#regex-engine#transpiler#syntax-highlighting#nodejs#javascript-regex#textmate-grammar#es-module

Links & Resources

Website

Included in

Regex360
Auto-fetched 11 hours ago

Related Projects

Regex+Regex+

JS regexes ➕ future. A template tag for readable, high-performance, native JS regexes with extended syntax, context-aware interpolation, and always-on best practices.

Stars632
Forks15
Last commit2 months ago
node-re2node-re2

Bindings for RE2: fast, safe alternative to backtracking regular expression engines.

Stars556
Forks60
Last commit12 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub