Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 18, 2024 via pnpm

to-regex 3.0.2

Generate a regex from a string or array of strings.
Package summary
Share
0
issues
1
license
15
MIT
Package created
27 Sep 2016
Version published
24 Feb 2018
Maintainers
1
Total deps
15
Direct deps
4
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
15 Packages, Including:
assign-symbols@1.0.0
define-property@2.0.2
extend-shallow@3.0.2
function-bind@1.1.2
hasown@2.0.2
is-accessor-descriptor@1.0.1
is-data-descriptor@1.0.1
is-descriptor@1.0.3
is-extendable@1.0.1
is-plain-object@2.0.4
isobject@3.0.1
regex-not@1.0.2
ret@0.1.15
safe-regex@1.1.0
to-regex@3.0.2
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

4
All Dependencies CSV
β“˜ This is a list of to-regex 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
define-property2.0.23.95 kBMIT
prod
extend-shallow3.0.23.13 kBMIT
prod
regex-not1.0.23.28 kBMIT
prod
safe-regex1.1.02.81 kBMIT
prod

Visualizations

Frequently Asked Questions

What does to-regex do?

The "to-regex" npm module is a handy tool with a principal task of converting a given string or an array of strings into a regular expression. This can be particularly useful in situations where you need to create dynamic regular expressions based on inputs.

How do you use to-regex?

Using "to-regex" in your Javascript project is quite straightforward. Firstly, you need to include the package in your project. You can do it by using npm, Node.js package manager, as shown below:

$ npm install --save to-regex

After successfully installing the module, you can utilize it within your project as follows:

var toRegex = require('to-regex');

console.log(toRegex('foo')); //=> /^(?:foo)$/
console.log(toRegex('foo', {negate: true})); //=> /^(?:(?:(?!^(?:foo)$).)*)$/
console.log(toRegex('foo', {contains: true})); //=> /(?:foo)/
console.log(toRegex(['foo', 'bar'], {negate: true})); //=> /^(?:(?:(?!^(?:(?:foo)|(?:bar))$).)*)$/
console.log(toRegex(['foo', 'bar'], {negate: true, contains: true})); //=> /^(?:(?:(?!(?:(?:foo)|(?:bar))).)*)$/

The "to-regex" function accepts two parameters. The first parameter is the input string or an array of strings that you wish to convert into a regex. The second parameter is an optional object where you can supply various configuration options to customize the generated regex, such as "contains", "negate", "nocase", "flags", "cache", and "safe".

Where are the to-regex docs?

The documentation for the "to-regex" module is available in the readme of the GitHub repository where the project is maintained. You can access the module's documentation by visiting the to-regex GitHub repository. These documents include detailed explanations for installation, usage, and available configuration options.