Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
XRegExp = require('xregexp-all.js')
XRegExp.new = XRegExp.XRegExp
XRegExp.new('\\p{L}+').test('啊囉哈')
# download XRegExp 1.5.0
wget http://xregexp.com/xregexp-min.js
# download XRegExp unicode modules
wget http://xregexp.com/plugins/xregexp-unicode-base.js
wget http://xregexp.com/plugins/xregexp-unicode-categories.js
wget http://xregexp.com/plugins/xregexp-unicode-scripts.js
wget http://xregexp.com/plugins/xregexp-unicode-blocks.js
# cat all files into one. note, xregexp-min.js should be
# on the top. here lexically m is front of u, so we
# don't need bother it
cat xregexp-*.js > xregexp-tmp.js
# convert CRLF to LF
tr -d "\r" < xregexp-tmp.js > xregexp-all.js
# make XRegExp a nodejs module
echo '
XRegExp.new = XRegExp;
var root;
root = (typeof exports !== "undefined" && exports !== null) ? exports : this;
root.XRegExp = XRegExp;' >> xregexp-all.js
@slevithan

This comment has been minimized.

Copy link

@slevithan slevithan commented May 27, 2012

As of XRegExp v2.0.0, you can just include xregexp-all.js. You can also install it via npm.

@godfat

This comment has been minimized.

Copy link
Owner Author

@godfat godfat commented May 28, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment