0.0.2 • Published 8 years ago

template-regexp v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

template-regexp Build Status

regular expressions inside of template literals

install

npm install --save template-regexp

regexp template strings

  • removes need to double escape
  • supports auto escaping of embeded expressions
  • automatically returns a valid RegExp

getters

  • g - adds global flag
  • i - adds ignore flag
  • m - adds multiline flag
  • u - adds unicode flag
  • y - adds sticky flag
  • _ - clears flags on regexp

usage

import r from 'template-regexp';

r`foo(bar)` // => /foo(bar)/

r`foo(bar)`.g // => /foo(bar)/g

r`foo${'(bar)'}`.g // => /foo\(bar\)/g

r`foo(${'(bar)'})`.g // => /foo(\(bar\))/g

r`foo(${'(bar)'})`.g.i.m.u.y // => /foo(\(bar\))/gimuy
0.0.2

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago