Skip to content

Converts Python-like (re) regular expressions to JavaScript RegExp instances

License

Notifications You must be signed in to change notification settings

jmchilton/pyre-to-regexp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyre-to-regexp

Converts Python-like (re) regular expressions to JavaScript RegExp instances

Build Status

This project is a fork of the MIT licensed pcre-to-regexp project from @TooTallNate. This fork is also MIT licensed.

Creates a JavaScript RegExp instance from a Python-like regexp string.

Works with Node.js and in the browser via a CommonJS bundler like browserify.

Installation

$ npm install pyre-to-regexp

API

pyre(String pattern[, Array keys]) → RegExp

Returns a JavaScript RegExp instance from the given Python-like regular expression string.

An empty array may be passed in as the second argument, which will be populated with the "named capture group" names as Strings in the Array, once the RegExp has been returned.

The returned RegExp has an additional function pyreReplace, for Python-like replacements

About

Converts Python-like (re) regular expressions to JavaScript RegExp instances

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •