@@ -20,8 +20,8 @@ var date = XRegExp('(?<year> [0-9]{4} ) -? # year \n\
2020 (?<day> [0-9]{2} ) # day ' , ' x' );
2121
2222// XRegExp.exec gives you named backreferences on the match result
23- var match = XRegExp .exec (' 2012 -02-22' , date);
24- match .year ; // -> '2012 '
23+ var match = XRegExp .exec (' 2014 -02-22' , date);
24+ match .year ; // -> '2014 '
2525
2626// It also includes optional pos and sticky arguments
2727var pos = 3 , result = [];
@@ -31,25 +31,25 @@ while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d+)>/, pos, 'sticky')) {
3131} // result -> ['2', '3', '4']
3232
3333// XRegExp.replace allows named backreferences in replacements
34- XRegExp .replace (' 2012 -02-22' , date, ' ${month}/${day}/${year}' ); // -> '02/22/2012 '
35- XRegExp .replace (' 2012 -02-22' , date, function (match ) {
34+ XRegExp .replace (' 2014 -02-22' , date, ' ${month}/${day}/${year}' ); // -> '02/22/2014 '
35+ XRegExp .replace (' 2014 -02-22' , date, function (match ) {
3636 return match .month + ' /' + match .day + ' /' + match .year ;
37- }); // -> '02/22/2012 '
37+ }); // -> '02/22/2014 '
3838
3939// In fact, XRegExps compile to RegExps and work perfectly with native methods
40- date .test (' 2012 -02-22' ); // -> true
40+ date .test (' 2014 -02-22' ); // -> true
4141
4242// The *only* caveat is that named captures must be referenced using numbered backreferences
43- ' 2012 -02-22' .replace (date, ' $2/$3/$1' ); // -> '02/22/2012 '
43+ ' 2014 -02-22' .replace (date, ' $2/$3/$1' ); // -> '02/22/2014 '
4444
4545// If you want, you can extend native methods so you don't have to worry about this.
4646// Doing so also fixes numerous browser bugs in the native methods
4747XRegExp .install (' natives' );
48- ' 2012 -02-22' .replace (date, ' ${month}/${day}/${year}' ); // -> '02/22/2012 '
49- ' 2012 -02-22' .replace (date, function (match ) {
48+ ' 2014 -02-22' .replace (date, ' ${month}/${day}/${year}' ); // -> '02/22/2014 '
49+ ' 2014 -02-22' .replace (date, function (match ) {
5050 return match .month + ' /' + match .day + ' /' + match .year ;
51- }); // -> '02/22/2012 '
52- date .exec (' 2012 -02-22' ).year ; // -> '2012 '
51+ }); // -> '02/22/2014 '
52+ date .exec (' 2014 -02-22' ).year ; // -> '2014 '
5353
5454// Extract every other digit from a string using XRegExp.forEach
5555XRegExp .forEach (' 1a2345' , / \d / , function (match , i ) {
@@ -241,7 +241,7 @@ require({paths: {xregexp: 'xregexp-all'}}, ['xregexp'], function(XRegExp) {
241241
242242## About
243243
244- XRegExp copyright 2007-present by [ Steven Levithan] ( http://stevenlevithan.com/ ) .
244+ XRegExp copyright 2007-2014 by [ Steven Levithan] ( http://stevenlevithan.com/ ) .
245245
246246Tools: Unicode range generators by [ Mathias Bynens] ( http://mathiasbynens.be/ ) , and adapted from his [ unicode-data] ( https://github.com/mathiasbynens/unicode-data ) project. Source file concatenator by [ Bjarke Walling] ( http://twitter.com/walling ) .
247247
0 commit comments