开发者社区> 镜像站> NPM> perl-regex
perl-regex
Perl regex engine for node.js
Last updated 3 years ago by aludirk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install perl-regex 
SYNC missed versions from official npm registry.

Perl regex engine for node.js

Binding Perl to enrich the regular expression from node.js, such as look behind assertion.

Requirements

Installation

npm install perl-regex

Examples

  • Match using regular expression in string:
let pregex = require('perl-regex');

console.log(pregex.match('EMAIL: test@example.com',
                         '^email: [a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$',
                         'i'));

// output:
// true
  • Match using RegExp object:
let pregex = require('perl-regex');

console.log(pregex.match('EMAIL: test@example.com',
                         /^email: [a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/i));

// output:
// true
  • Exec regular expression in string:
let pregex = require('perl-regex');

console.log(pregex.exec('Great responsibility comes with great power',
                        '(?<=great )\\w+',
                        'gi'));

// output:
// [ 'power', 'responsibility', 'power' ]
  • Exec RegExp object:
let pregex = require('perl-regex');

console.log(pregex.exec('https://127.0.0.1:1314/index.html',
                        /(https?):\/\/(\d+\.\d+\.\d+\.\d+):(\d+)\/([a-zA-z.]+)/));

// output:
// [ 'https://127.0.0.1:1314/index.html',
//   'https',
//   '127.0.0.1',
//   '1314',
//   'index.html' ]

Current Tags

  • 1.0.4                                ...           latest (3 years ago)

5 Versions

  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (1)
Dependents (1)