Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

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

TermsPrivacyAboutGitHubRSS
  1. Home
  2. ES6 Tools
  3. regexpu

regexpu

MITJavaScriptv2.0.0

A source code transpiler that rewrites ES2015 Unicode regular expressions with the 'u' flag into ES5-compatible equivalents.

Visit WebsiteGitHubGitHub
241 stars18 forks0 contributors

What is regexpu?

regexpu is a source code transpiler that enables the use of ES2015 Unicode regular expressions in ES5 environments. It rewrites regular expression literals that use the `u` flag into equivalent ES5-compatible patterns, allowing developers to leverage modern Unicode regex features while maintaining compatibility with older JavaScript engines.

Target Audience

JavaScript developers working on projects that need to support ES5 environments but want to use ES2015 Unicode regex features like the `u` flag, Unicode property escapes, or the `s` (dotAll) flag. It is also used by transpiler maintainers integrating Unicode regex support into tools like Babel, Traceur, esnext, and Bublé.

Value Proposition

Developers choose regexpu because it provides accurate and efficient transpilation of Unicode regular expressions, is battle-tested as the internal engine for major transpilers, and offers optional experimental support for newer regex features like the `s` flag and Unicode property escapes.

Overview

A source code transpiler that enables the use of ES2015 Unicode regular expressions in ES5.

Use Cases

Best For

  • Transpiling ES2015+ JavaScript code with Unicode regex literals for compatibility with ES5 environments.
  • Integrating Unicode regex support into custom transpilers or build tools.
  • Writing modern JavaScript with Unicode regex features (e.g., matching emoji or Unicode code points) while targeting older browsers or Node.js versions.
  • Experimenting with advanced regex features like the `s` (dotAll) flag or Unicode property escapes in pre-ES2018 environments.
  • Converting regex patterns with the `u` flag into equivalent ES5 syntax for use in legacy codebases.
  • Source code transformation tasks that require rewriting regular expression literals in ASTs or raw code strings.

Not Ideal For

  • Projects heavily using dynamic RegExp('...', 'u') constructors, as regexpu only transpiles literal expressions.
  • Applications targeting exclusively modern environments where ES2015+ Unicode regex features are natively supported, making transpilation unnecessary.
  • Use cases requiring polyfilling of the RegExp.prototype.unicode getter for runtime feature detection or API consistency.
  • Scenarios where accurate matching of lone low surrogates is critical, due to JavaScript regex limitations that regexpu cannot overcome.

Pros & Cons

Pros

Unicode Regex Transpilation

Accurately rewrites ES2015 regex literals with the 'u' flag into ES5-compatible patterns, enabling features like Unicode code point matching in older environments, as demonstrated in the README examples.

Industry-Standard Integration

Used internally by major transpilers like Babel and Traceur, ensuring battle-tested reliability and seamless adoption in existing build pipelines, per the project's documentation.

Flexible Transformation APIs

Offers multiple methods including rewritePattern for individual patterns and transpileCode for entire source files, catering to different use cases like AST manipulation or direct code rewriting.

Experimental Feature Support

Provides optional flags for newer regex features like the 's' (dotAll) flag and Unicode property escapes, allowing early adoption in ES5 contexts with configurable options.

Cons

Literal-Only Limitation

Cannot transpile dynamic regex patterns created with RegExp('...', 'u'), restricting its applicability to only regex literals in source code, as admitted in the known limitations.

Admitted Inaccuracies

Has known issues such as incomplete support for back-references with both 'i' and 'u' flags, and inability to accurately match lone low surrogates due to JavaScript regex constraints.

Dependency Overhead

Relies on several internal dependencies like Recast and Esprima, which may bloat builds if only core functionality is needed, though modular imports are possible to mitigate this.

Frequently Asked Questions

Quick Stats

Stars241
Forks18
Contributors0
Open Issues3
Last commit24 days ago
CreatedSince 2014

Tags

#unicode#regex#transpiler#regular-expression#ecmascript#regexp#es5#javascript#compatibility#es2015#ast#code-generation

Built With

E
Esprima
R
Recast
N
Node.js

Links & Resources

Website

Included in

ES6 Tools4.0kRegex360
Auto-fetched 1 day ago

Related Projects

BabelBabel

🐠 Babel is a compiler for writing next generation JavaScript.

Stars44,044
Forks5,953
Last commit1 day ago
Traceur compilerTraceur compiler

Traceur is a JavaScript.next-to-JavaScript-of-today compiler

Stars8,125
Forks566
Last commit1 year ago
LebabLebab

Turn your ES5 code into readable ES6. Lebab does the opposite of what Babel does.

Stars5,631
Forks151
Last commit4 days ago
regeneratorregenerator

Source transformer enabling ECMAScript 6 generator functions in JavaScript-of-today.

Stars3,822
Forks1,130
Last commit2 years 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