node-flux is a Node.js port of Selvin Ortiz' Flux.php
Currently node-flux is Node.js compatible as it makes use of the util
library. I'm looking to change this in the near future to be usable in the browser and on the server.
Flux opens up a new world when writing regular expressions. Using powerful method names, you can build reliable and consistent regular expressions. For example
var Flux = require('flux');
var socialTest = new Flux(); // Let's create a new Flux object for a test
socialTest.startOfLine().either('Twitter', 'Facebook', 'Google+').ignoreCase().endOfLine();
var testString = 'Path';
if(socialTest.match(testString)) {
console.log('Get out of here Path!');
}else{
console.log('No match!');
}
Examples are provided in the /examples
directory. You can test them with node examples/usdate.js
or node examples/usphone.js
More examples will be added as the syntax evolves or changes.
- Added
getSegments()
- Added
removeSegment()
- Added
lineBreak()
andbr()
to match new lines (DOS/Unix) - Added
clear()
to empty the current pattern and modifiers - Added
getPattern()
which is an alias to compile - Fixes mixed logic between
add()
andraw()
- Fixes implementation on
orTry()
- Updated the test pattern used
- Improved README to demo the power of Flux.
- Added
addSeed()
,removeSeed()
- Seeds can be passed through as final arguments in
match()
andreplace()
- Added
toString()
which will compile your pattern with modifiers - Added new tests
- Added
getSegment()
. When passed an integer will return that position in the pattern. Default is0
.
- Changed version to minor version 1 as the syntax is working and passes all examples used by the the Flux.php
- Added
global()
modifier (g) - Added new test for
global()
modifier
- Added examples
usdate.js
andusphone.js
- Commented code a little
- Adds the
letters()
method - Renamed
numbers()
todigits()
- Adds support for quantifiers in
digits()
- Adds
ignoreCase()
as an alias forinAnyCase()