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

xregexp

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xregexp

Extended regular expressions

  • 5.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4M
decreased by-53.21%
Maintainers
2
Weekly downloads
 
Created

What is xregexp?

The xregexp npm package is an extended JavaScript regex library that provides additional syntax and features on top of the standard JavaScript RegExp object. It allows for more readable and maintainable regular expressions, adds new regex syntax, and provides utility functions for working with regular expressions.

What are xregexp's main functionalities?

Extended Syntax

Allows the use of Unicode property escapes for matching characters of a given Unicode category, such as letters (\p{L}).

/\p{L}+/u

Named Capture Groups

Supports named capture groups, which can be accessed by name after a match, making the regex more readable and maintainable.

XRegExp('(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})')

Add-ons and Extensibility

Provides a plugin-style architecture for adding new features like namespacing, which allows using regex flags in a scoped manner.

XRegExp.install('namespacing'); XRegExp('\p{Greek}+', 'A');

Build Regexes from Smaller Parts

Enables the construction of complex regexes from smaller, reusable components, improving modularity and readability.

XRegExp.build('(?x)^ {{integer}} (\. {{integer}})? $', {integer: /\d+/})

Utility Functions

Includes utility functions like matchRecursive for matching balanced pairs of delimiters, which is not possible with native JavaScript regexes.

XRegExp.matchRecursive('test (123 (test) 456) test', '\(', '\)', 'g')

Other packages similar to xregexp

Keywords

FAQs

Package last updated on 05 Jun 2022

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