regex-parse
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Regex Parse Travis CI Build Status

Parse a regex into it's individual parts.

NPM Badge

Install

npm install regex-parse

Usage

const regexParse = require("regex-parse");
 
regexParse(/a/g);
//=> { main: "a", options: "g" }
 
regexParse.from({ main: "a", options: "g" })
//=> /a/g

API

regexParse(regex)

regex

Type: RegExp | string

The regex to parse.

regexParser.from(options)

options

Type: object

main

Type: string

The first part of the regex.

options

Type: string

The second part of the regex.

Package Sidebar

Install

npm i regex-parse

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

3.92 kB

Total Files

6

Last publish

Collaborators

  • richienb