Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

regexpp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regexpp

Regular expression parser for ECMAScript 2018.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18M
increased by16.1%
Maintainers
1
Weekly downloads
 
Created

What is regexpp?

The regexpp npm package is a library for parsing and manipulating regular expressions in JavaScript. It provides a detailed regular expression parser with a visitor interface for traversing abstract syntax trees, and utilities for working with regular expressions.

What are regexpp's main functionalities?

Regular Expression Parser

This feature allows you to parse a regular expression literal into an abstract syntax tree (AST), which can then be traversed or manipulated.

const { parseRegExpLiteral } = require('regexpp');
const ast = parseRegExpLiteral('/abc/g');

RegExp Visitor

This feature provides a visitor interface to traverse the AST nodes of a parsed regular expression, allowing you to perform operations on individual nodes.

const { RegExpParser, visitRegExpAST } = require('regexpp');
const parser = new RegExpParser();
const ast = parser.parsePattern('a|b');
visitRegExpAST(ast, {
  onCharacterEnter(node) {
    console.log(node.value);
  }
});

RegExp Validator

This feature allows you to validate a regular expression pattern for syntax errors, which is useful for ensuring patterns are correct before using them.

const { RegExpValidator } = require('regexpp');
const validator = new RegExpValidator();
try {
  validator.validatePattern('(?<name>a)');
} catch (error) {
  console.error(error.message);
}

Other packages similar to regexpp

Keywords

FAQs

Package last updated on 06 Mar 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc