1.0.0 • Published 5 years ago

regextract v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

regextract

Extracting text with Regular Expression

npm Build Status

Install

npm install regextract --save

API

var result = extract(text, RegExp);

result.matches

Type: Array

Matches of RegExp patterns to the source text.

result.extracts

Type: Array

Captured groups of capturing parentheses within RegExp patterns to the source text.

result.captured

Type: Array

Alias to result.extracts.

Usage

Require package

var extract = require('regextract');

Find matches

extract('iPhone6, iPhone7, iPhone8, iPhoneX', /iPhone\d/g);

// You'll get:
{
  matches: ['iPhone6', 'iPhone7', 'iPhone8'],
  extracts: []
}

Get extracted texts

extract('Price: NTD$299', /NTD\$(\d+)/g)

// You'll get:
{
  matches: ['NTD$299'],
  extracts: ['299']
}

License

MIT

1.0.0

5 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago