You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51-19Lines changed: 51 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
4
4
XRegExp provides augmented, extensible, cross-browser JavaScript regular expressions. You get new syntax and flags beyond what browsers support natively, along with a collection of utils to make your client-side grepping and parsing easier. XRegExp also frees you from worrying about pesky inconsistencies in cross-browser regex handling and the dubious `lastIndex` property.
5
5
6
-
XRegExp supports all native ES5 regular expression syntax. It clocks in at ~3.5 KB when minified and gzipped, and it works with Internet Explorer 5.5+, Firefox 1.5+, Chrome, Safari 3+, and Opera 9.5+.
6
+
XRegExp supports all native ES5 regular expression syntax. It's about 3.5 KB when minified and gzipped. It works with Internet Explorer 5.5+, Firefox 1.5+, Chrome, Safari 3+, and Opera 9.5+.
These examples should give you the flavor of what's possible, but XRegExp has plenty more syntax, flags, utils, options, and browser fixes that aren't shown here. You can even augment XRegExp's regular expression syntax with addons (see below) or write your own. See [xregexp.com](http://xregexp.com) for more details.
78
+
These examples should give you the flavor of what's possible, but XRegExp has more syntax, flags, utils, options, and browser fixes that aren't shown here. You can even augment XRegExp's regular expression syntax with addons (see below) or write your own. See [xregexp.com](http://xregexp.com/) for more details.
79
79
80
80
81
-
## XRegExp Unicode Base
81
+
## Addons
82
82
83
-
First include the Unicode Base script:
83
+
In browsers, you can either load addons individually, or bundle all addons together with XRegExp by loading `xregexp-all.js`. XRegExp's [npm](http://npmjs.org/) package uses `xregexp-all.js`, which means that the addons are always available when XRegExp is installed on the server using npm.
84
+
85
+
86
+
### XRegExp Unicode Base
87
+
88
+
In browsers, first include the Unicode Base script:
**Lookbehind:** A [collection of short functions](https://gist.github.com/2387872) is available that makes it easy to simulate infinite-length leading lookbehind.
227
+
In browsers:
223
228
229
+
~~~html
230
+
<scriptsrc="xregexp-min.js"></script>
231
+
~~~
224
232
225
-
## How to run tests on the server with npm
233
+
Or, to bundle XRegExp with all of its addons:
234
+
235
+
~~~html
236
+
<scriptsrc="xregexp-all-min.js"></script>
237
+
~~~
238
+
239
+
Using [npm](http://npmjs.org/):
240
+
241
+
~~~bash
242
+
npm install xregexp
243
+
~~~
244
+
245
+
In [Node.js](http://nodejs.org/) and [CommonJS module](http://wiki.commonjs.org/wiki/Modules) loaders:
246
+
247
+
~~~js
248
+
var XRegExp =require('xregexp').XRegExp;
249
+
~~~
250
+
251
+
252
+
### Running tests on the server with npm
226
253
227
254
~~~bash
228
255
npm install -g qunit # needed to run the tests
229
-
npm test# in the xregexp root directory
256
+
npm test# in the xregexp root
230
257
~~~
231
258
232
-
For non-npm users, just open `tests/index.html` in your browser.
259
+
If XRegExp was not installed using npm, just open `tests/index.html` in your browser.
260
+
261
+
262
+
## &c
263
+
264
+
**Lookbehind:** A [collection of short functions](https://gist.github.com/2387872) is available that makes it easy to simulate infinite-length leading lookbehind.
0 commit comments