
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
regjsparser
Advanced tools
Parsing the JavaScript's RegExp in JavaScript.
npm install regjsparser
var parse = require('regjsparser').parse;
var parseTree = parse('^a'); // /^a/
console.log(parseTree);
// Toggle on/off additional features:
var parseTree = parse('^a', '', {
// SEE: https://github.com/jviereck/regjsparser/pull/78
unicodePropertyEscape: true,
// SEE: https://github.com/jviereck/regjsparser/pull/83
namedGroups: true,
// SEE: https://github.com/jviereck/regjsparser/pull/89
lookbehind: true
});
console.log(parseTree);
To run the tests, run the following command:
npm test
To create a new reference file, execute…
node test/update-fixtures.js
…from the repo top directory.
regexpp is a regular expression parser for ECMAScript. It parses regular expressions into an AST and provides utilities for traversing and analyzing the AST. Compared to regjsparser, regexpp offers more detailed error messages and supports the latest ECMAScript features.
regexp-tree is a regular expression processing library that includes a parser, transformer, and optimizer. It parses regular expressions into an AST and provides tools for transforming and optimizing them. Unlike regjsparser, regexp-tree focuses on providing a complete suite of tools for working with regular expressions.
regex-parser is a simple library for parsing regular expressions into an AST. It is less feature-rich compared to regjsparser and focuses on providing a minimalistic approach to parsing regular expressions.
FAQs
Parsing the JavaScript's RegExp in JavaScript.
The npm package regjsparser receives a total of 27,190,388 weekly downloads. As such, regjsparser popularity was classified as popular.
We found that regjsparser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.