RegExp Literal AST Parser
JSON →regexp-parser-literal is a JavaScript and TypeScript library designed for parsing regular expression literals into an Abstract Syntax Tree (AST). It provides a convenient API built on top of the `regexpp2` library, offering functions such as `parseRegExp` to convert a full regular expression string into its AST representation, `parseFlags` for flag extraction, `parsePattern` for the pattern part, and `astToString` for serializing an AST back into a regular expression string. The current stable version is 1.1.40. While it does not adhere to a strict release cadence, updates are typically driven by enhancements to its underlying `regexpp2` dependency or specific utility requirements, such as improved emoji handling. A key differentiator is its ready-to-use utility functions that streamline common regex AST manipulations and its inclusion of a pre-defined `EMOJI_REGEX`. This makes it particularly useful for applications requiring programmatic analysis, validation, transformation, or generation of regular expressions, often found in linters, code formatting tools, or domain-specific language compilers. It aims to simplify direct interaction with the powerful `regexpp2` parser for common use cases.
Traffic · last 30 days ↑0% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇬🇧 United Kingdom · 🇩🇪 Germany · 🇫🇷 France