|
|
|
|
!function(a,b){var c;"function"==typeof define?define(b):"object"==typeof exports?(c=b(),("object"==typeof module?module.exports=c:exports).XRegExp=c):a.XRegExp=b()}(this,function(){var a=function(a){"use strict";function u(a,d,e,f,g){var h;if(a[c]={captureNames:d},g)return a;if(a.__proto__)a.__proto__=b.prototype;else for(h in b.prototype)a[h]=b.prototype[h];return a[c].source=e,a[c].flags=f?f.split("").sort().join(""):f,a}function v(a){return e.replace.call(a,/([\s\S])(?=[\s\S]*\1)/g,"")}function w(d,f){if(!b.isRegExp(d))throw new TypeError("Type RegExp expected");var g=d[c]||{},h=y(d),i="",j="",k=null,l=null;return f=f||{},f.removeG&&(j+="g"),f.removeY&&(j+="y"),j&&(h=e.replace.call(h,new RegExp("["+j+"]+","g"),"")),f.addG&&(i+="g"),f.addY&&(i+="y"),i&&(h=v(h+i)),f.isInternalOnly||(g.source!==a&&(k=g.source),null!=g.flags&&(l=i?v(g.flags+i):g.flags)),d=u(new RegExp(d.source,h),z(d)?g.captureNames.slice(0):null,k,l,f.isInternalOnly)}function x(a){return parseInt(a,16)}function y(a){return q?a.flags:e.exec.call(/\/([a-z]*)$/i,RegExp.prototype.toString.call(a))[1]}function z(a){return!(!a[c]||!a[c].captureNames)}function A(a){return parseInt(a,10).toString(16)}function B(a,b){var d,c=a.length;for(d=0;c>d;++d)if(a[d]===b)return d;return-1}function C(a,b){return s.call(a)==="[object "+b+"]"}function D(a,b,c){return e.test.call(c.indexOf("x")>-1?/^(?:\s+|#.*|\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/:/^(?:\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/,a.slice(b))}function E(a){for(;a.length<4;)a="0"+a;return a}function F(a,b){var c;if(v(b)!==b)throw new SyntaxError("Invalid duplicate regex flag "+b);for(a=e.replace.call(a,/^\(\?([\w$]+)\)/,function(a,c){if(e.test.call(/[gy]/,c))throw new SyntaxError("Cannot use flag g or y in mode modifier "+a);return b=v(b+c),""}),c=0;c<b.length;++c)if(!r[b.charAt(c)])throw new SyntaxError("Unknown regex flag "+b.charAt(c));return{pattern:a,flags:b}}function G(a){var c={};return C(a,"String")?(b.forEach(a,/[^\s,]+/,function(a){c[a]=!0}),c):a}function H(a){if(!/^[\w$]$/.test(a))throw new Error("Flag must be a single character A-Za-z0-9_$");r[a]=!0}function I(a,c,d,e,f){for(var k,l,g=i.length,h=a.charAt(d),j=null;g--;)if(l=i[g],!(l.leadChar&&l.leadChar!==h||l.scope!==e&&"all"!==l.scope||l.flag&&-1===c.indexOf(l.flag))&&(k=b.exec(a,l.regex,d,"sticky"))){j={matchLength:k[0].length,output:l.handler.call(f,k,e,c),reparse:l.reparse};break}return j}function J(a){d.astral=a}function K(a){RegExp.prototype.exec=(a?f:e).exec,RegExp.prototype.test=(a?f:e).test,String.prototype.match=(a?f:e).match,String.prototype.replace=(a?f:e).replace,String.prototype.split=(a?f:e).split,d.natives=a}function L(a){if(null==a)throw new TypeError("Cannot convert null or undefined to object");return a}var b,t,c="xregexp",d={astral:!1,natives:!1},e={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},f={},g={},h={},i=[],j="default",k="class",l={"default":/\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??|[\s\S]/,"class":/\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|[\s\S]/},m=/\$(?:{([\w$]+)}|(\d\d?|[\s\S]))/g,n=e.exec.call(/()??/,"")[1]===a,o=function(){var a=!0;try{new RegExp("","u")}catch(b){a=!1}return a}(),p=function(){var a=!0;try{new RegExp("","y")}catch(b){a=!1}return a}(),q=/a/.flags!==a,r={g:!0,i:!0,m:!0,u:o,y:p},s={}.toString;return b=function(c,d){var n,o,p,q,r,f={hasNamedCapture:!1,captureNames:[]},g=j,i="",m=0;if(b.isRegExp(c)){if(d!==a)throw new TypeError("Cannot supply flags when copying a RegExp");return w(c)}if(c=c===a?"":String(c),d=d===a?"":String(d),b.isInstalled("astral")&&-1===d.indexOf("A")&&(d+="A"),h[c]||(h[c]={}),!h[c][d]){for(n=F(c,d),q=n.pattern,r=n.flags;m<q.length;){do n=I(q,r,m,g,f),n&&n.reparse&&(q=q.slice(0,m)+n.output+q.slice(m+n.matchLength));while(n&&n.reparse);n?(i+=n.output,m+=n.matchLength||1):(o=b.exec(q,l[g],m,"sticky")[0],i+=o,m+=o.length,"["===
|