Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 9, 2024 via pnpm

xregexp 4.0.0

Extended regular expressions
Package summary
Share
0
issues
1
license
1
MIT
Package created
30 Jun 2011
Version published
2 Jan 2018
Maintainers
2
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
xregexp@4.0.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of xregexp 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does xregexp do?

XRegExp is a JavaScript library aimed at providing augmented and extensible regular expressions. It enhances the native JavaScript offers, delivering modern syntax and flags outside of what's offered by browsers. At its core, XRegExp compiles to native RegExp objects, ensuring equivalent performance while also addressing regex cross-browser inconsistencies. Not only does it support all native ES6 regular expression syntax, but a significant number of XRegExp's features have also been adopted into new JavaScript standards, including named capturing, Unicode properties/scripts/categories, sticky matching, and more. This makes XRegExp an excellent tool for extending these features to older browsers.

How do you use xregexp?

To utilize XRegExp, you can include it in your JavaScript clause by installing the xregexp npm package, or by loading it via script tag in the browser. Once installed, you can employ the XRegExp function for creating regular expressions, replacing strings, extracting data, and more. Below are some code examples demonstrating its usage:

// Create a regular expression using XRegExp
const date = XRegExp('(?<year>[0-9]{4})-(?<month>[0-9]{2})-(?<day>[0-9]{2})');

// Use the created regular expression to extract data
let match = XRegExp.exec('2021-02-22', date);
console.log(match.groups.year); // Outputs: '2021'

// Replace text using a created regular expression
let replacedText = XRegExp.replace('2021-02-22', date, '$<month>/$<day>/$<year>');
console.log(replacedText); // Outputs: '02/22/2021'

The examples above demonstrate basic use of XRegExp, but the library offers various other syntax, flags, methods, and options that you can employ to handle more intricate use-cases.

Where are the xregexp docs?

The comprehensive documentation for XRegExp, which includes details about all its functionalities, add-ons, and examples, can be found on its official website, xregexp.com. There, you can explore the functionalities more deeply, giving you dynamic control over your regular expressions in a way that native JavaScript doesn't allow.