0.2.0 • Published 8 years ago
re_expand v0.2.0
re_expand
Generates all text strings that match the given regexp
"(a|b)(1|2)".expand()
=>["a1", "a2", "b1", "b2"]
- If a filter pattern is given, the output is filtered by the pattern.
Resources
Install
$ npm install re_expand
Usage
see sample/*.coffee.
require 're_expand'
console.log "(a|b|c)(x|y|z)(1|2|3)".expand()
Generator = require 're_expand'
generator = new Generator()
generator.add "(abc|def)(ghi|jkl)", 'Pattern "$1" and "$2".'
f = (a, cmd) -> console.log "#{a} => #{cmd}"
generator.filter " a ", f, 0