File: src/js/Regex.min.js

Recommend this page to a friend!
  Classes of Nikos M.  >  PHP Regex Analyzer and Composer  >  src/js/Regex.min.js  >  Download  
File: src/js/Regex.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Regex Analyzer and Composer
Analyze and compose regular expressions
Author: By
Last change:
Date: 2 months ago
Size: 24,095 bytes
 

 

Contents

Class file image Download
/**
*
*   Regex
*   @version: 1.1.0
*
*   A simple & generic Regular Expression Analyzer & Composer for PHP, Python, Node.js / Browser / XPCOM Javascript
*   https://github.com/foo123/RegexAnalyzer
*
**/
!function(e,n,t){"use strict";"undefined"!=typeof Components&&"object"==typeof Components.classes&&"object"==typeof Components.classesByID&&Components.utils&&"function"==typeof Components.utils.import?(e.$deps=e.$deps||{})&&(e.EXPORTED_SYMBOLS=[n])&&(e[n]=e.$deps[n]=t.call(e)):"object"==typeof module&&module.exports?(module.$deps=module.$deps||{})&&(module.exports=module.$deps[n]=t.call(e)):"undefined"!=typeof System&&"function"==typeof System.register&&"function"==typeof System.import?System.register(n,[],function(r){r(n,t.call(e))}):"function"==typeof define&&define.amd&&"function"==typeof require&&"function"==typeof require.specified&&require.specified(n)?define(n,["module"],function(n){return t.moduleUri=n.uri,t.call(e)}):n in e||(e[n]=t.call(e)||1)&&"function"==typeof define&&define.amd&&define(function(){return e[n]})}("undefined"!=typeof self?self:this,"Regex",function(e){"use strict";function n(e){return e instanceof Array||"[object Array]"===f.call(e)}function t(e){return e instanceof String||"[object String]"===f.call(e)}function r(e){return n(e)?e:[e]}function a(e,n){n=n||{};for(var t in e)h.call(e,t)&&(n[t]=e[t]);return n}function l(e){var n=this;n.re=e,n.len=e.length,n.pos=0,n.index=0,n.groupIndex=0,n.group={},n.inGroup=0}function u(e,n,t){var r=this;if(!(r instanceof u))return new u(e,n,t);switch(r.type=e,r.val=n,r.flags=t||{},e){case G:r.typeName="Sequence";break;case x:r.typeName="Alternation";break;case S:r.typeName="Group";break;case M:r.typeName="CharacterGroup";break;case I:r.typeName="Characters";break;case E:r.typeName="CharacterRange";break;case R:r.typeName="String";break;case b:r.typeName="Quantifier";break;case N:r.typeName="UnicodeChar";break;case k:r.typeName="HexChar";break;case O:r.typeName="Special";break;case A:r.typeName="Comment";break;default:r.typeName="unspecified"}}function o(e,n){if(!(this instanceof o))return new o(e,n);e&&this.input(e,n)}function s(){var e=this;if(!(e instanceof s))return new s;e.re=null,e.reset()}var i="prototype",p=Object[i],c=Array[i],f=(Object.keys,p.toString),h=p.hasOwnProperty,g=String.fromCharCode,v="charAt",d="charCodeAt",m=(JSON.stringify,"\\"),y={".":"MatchAnyChar","|":"MatchEither","?":"MatchZeroOrOne","*":"MatchZeroOrMore","+":"MatchOneOrMore","^":"MatchStart",$:"MatchEnd","{":"StartRepeats","}":"EndRepeats","(":"StartGroup",")":"EndGroup","[":"StartCharGroup","]":"EndCharGroup"},C={"\\":"ESC","/":"/",0:"NULChar",f:"FormFeed",n:"LineFeed",r:"CarriageReturn",t:"HorizontalTab",v:"VerticalTab",b:"MatchWordBoundary",B:"MatchNonWordBoundary",s:"MatchSpaceChar",S:"MatchNonSpaceChar",w:"MatchWordChar",W:"MatchNonWordChar",d:"MatchDigitChar",D:"MatchNonDigitChar"},G=1,x=2,S=4,M=8,b=16,N=32,k=64,O=128,I=256,E=512,R=1024,A=2048;l[i]={constructor:l,re:null,len:null,pos:null,index:null,groupIndex:null,inGroup:null,groups:null,dispose:function(){var e=this;e.re=null,e.len=null,e.pos=null,e.index=null,e.groupIndex=null,e.group=null,e.inGroup=null}},u.toObjectStatic=function e(t){return t instanceof u?t.flags&&Object.keys(t.flags).length?{type:t.typeName,value:e(t.val),flags:t.flags}:{type:t.typeName,value:e(t.val)}:n(t)?t.map(e):t},u[i]={constructor:u,type:null,typeName:null,val:null,flags:null,dispose:function(){var e=this;return e.val=null,e.flags=null,e.type=null,e.typeName=null,e},toObject:function(){return u.toObjectStatic(this)}};var L=function(e,n){return Math.round((n-e)*Math.random()+e)},j=function(e,n){return new RegExp(e,n||"")},B=function(e){return c.slice.apply(e,c.slice.call(arguments,1))},w=function(e){for(var n=[],t=0;t<e.length;)n=n.concat(e[t++]);return n},z=function(e,n){return w(B(e))},D=function(e,n,t){var r,a="",l=e.length,u=0;if(t)for(;u<l;)a+=("-"===(r=e[v](u++))||"^"===r||"$"===r||"|"===r||"{"===r||"}"===r||"("===r||")"===r||"["===r||"]"===r||"/"===r||n===r?n:"")+r;else for(;u<l;)a+=("?"===(r=e[v](u++))||"*"===r||"+"===r||"."===r||"^"===r||"$"===r||"|"===r||"{"===r||"}"===r||"("===r||")"===r||"["===r||"]"===r||"/"===r||n===r?n:"")+r;return a},U=function(e,n,t){var r=String(e);for(t=t||"0";r.length<n;)r=t+r;return r},F=function(e){return e[d](0)},$=function(e,t){e&&n(e)&&(t=e[1],e=e[0]);var r,a,l=e[d](0),u=t[d](0);if(u===l)return[g(l)];for(a=[],r=l;r<=u;++r)a.push(g(r));return a},P=function(e,t){if(t){var r,a;if(n(t))for(r=0,a=t.length;r<a;r++)e[t[r]]=1;else for(r in t)h.call(t,r)&&(e[r]=1)}return e},W="~!@#$%^&*()-+=[]{}\\|;:,./<>?",q="0123456789",T=function(e){return[e[d](0),e[d](e.length-1)]}(q),Z=[T,[F("a"),F("f")],[F("A"),F("F")]],V="_"+$("a","z").join("")+$("A","Z").join(""),_=" \t\v"+W+q+V,H=_.split(""),X=function(e,n,t,r,a){t=t||0,r=r||1,a=a||1/0;for(var l=t,u=0,o=n.length;l<o&&u<=a&&-1<e.indexOf(n[v](l));)l++,u++;return u>=r&&u},Y=function(e,n,t,r,a){t=t||0,r=r||1,a=a||1/0;for(var l,u=t,o=0,s=n.length;u<s&&o<=a&&(l=n[d](u))>=e[0]&&l<=e[1];)u++,o++;return o>=r&&o},J=function(e,n,t,r,a){t=t||0,r=r||1,a=a||1/0;for(var l,u,o,s=t,i=0,p=n.length,c=e.length,f=!0;s<p&&i<=a&&f;)for(l=n[d](s),f=!1,u=0;u<c;u++)if(o=e[u],l>=o[0]&&l<=o[1]){s++,i++,f=!0;break}return i>=r&&i},Q=function(){return W[v](L(0,W.length-1))},K=function(e){return!1!==e?" \t\v"[v](L(0," \t\v".length-1)):(Q()+ee()+ne())[v](L(0,2))},ee=function(e){return!1!==e?q[v](L(0,q.length-1)):(Q()+K()+ne())[v](L(0,2))},ne=function(e){return!1!==e?V[v](L(0,V.length-1)):(Q()+K()+ee())[v](L(0,2))},te=function(e){return!1!==e?(V+q)[v](L(0,V.length+q.length-1)):(Q()+K())[v](L(0,1))},re=function(){return _[v](L(0,_.length-1))},ae=function(e,n){if(!1!==n)return e.length?e[L(0,e.length-1)]:"";var t=H.filter(function(n){return 0>e.indexOf(n)});return t.length?t[L(0,t.length-1)]:""},le=function(e){return.5<Math.random()?e.toLowerCase():e.toUpperCase()},ue=function(e,n){return n?(e[v]&&(e=e.split("")),e=e.map(le)):le(e)},oe=function e(n,t,a){if(null==t||!a)return n;var l,o,s,i=t instanceof u?t.type:null;if(null===i)n=a.reduce(n,t,a);else if(a.IGNORE&i);else if(a.MAP&i){if(s=a.map(n,t,a),null!=a.ret)n=a.reduce(n,t,a),a.ret=null;else if(null!=s)for(l=0,o=(s=r(s))?s.length:0;l<o;l++)if(a.node=t,n=e(n,s[l],a),a.stop)return a.stop=null,n}else a.REDUCE&i&&(n=a.reduce(n,t,a));return a.node=null,n},se=function(e,n,t){var a=n.type;if(x===a){for(var l=[],u=0,o=n.val.length-1;u<o;u++)l.push(n.val[u],"|");return l.push(n.val[o]),l}if(M===a)return[].concat("["+(n.flags.NegativeMatch?"^":"")).concat(r(n.val)).concat("]");if(b===a){var s="";return s=n.flags.MatchZeroOrOne?"?":n.flags.MatchZeroOrMore?"*":n.flags.MatchOneOrMore?"+":n.flags.min===n.flags.max?"{"+n.flags.min+"}":"{"+n.flags.min+","+(-1===n.flags.max?"":n.flags.max)+"}",n.flags.min===n.flags.max||n.flags.isGreedy||(s+="?"),[].concat(r(n.val)).concat(s)}if(S===a){var i=null;return i=n.flags.NotCaptured?[].concat("(?:").concat(r(n.val)).concat(")"):n.flags.LookAhead?[].concat("(?=").concat(r(n.val)).concat(")"):n.flags.NegativeLookAhead?[].concat("(?!").concat(r(n.val)).concat(")"):n.flags.LookBehind?[].concat("(?<=").concat(r(n.val)).concat(")"):n.flags.NegativeLookBehind?[].concat("(?<!").concat(r(n.val)).concat(")"):[].concat("(").concat(r(n.val)).concat(")"),null!=n.flags.GroupIndex&&(e.group[n.flags.GroupIndex]=n.flags.GroupIndex,n.flags.GroupName&&(e.group[n.flags.GroupName]=n.flags.GroupIndex)),i}return n.val},ie=function(e,n,t){var r=n.type;if(x===r||M===r)return n.val.length?n.val[L(0,n.val.length-1)]:null;if(b===r){var a,l,u,o;if(e.length>=t.maxLength?a=n.flags.min:(l=n.flags.min,u=-1===n.flags.max?l+1+2*t.maxLength:n.flags.max,a=L(l,u)),a){o=new Array(a);for(var s=0;s<a;s++)o[s]=n.val;return o}return null}if(S===r&&n.flags.GroupIndex){var i=oe("",n.val,t);return t.group[n.flags.GroupIndex]=i,t.ret=i,null}return n.val},pe=function(e,n,t){var r=n.type;if(x===r){var a,l=n.val.length,u=l?oe(0,n.val[0],t):0;for(o=1;o<l;o++)(a=oe(0,n.val[o],t))<u&&(u=a);return l&&(t.ret=u),null}if(M===r)return n.val.length?n.val[0]:null;if(b===r){if(0===n.flags.min)return null;var o,s=n.flags.min,i=new Array(s);for(o=0;o<s;o++)i[o]=n.val;return i}if(S===r&&n.flags.GroupIndex){u=oe(0,n.val,t);return t.group[n.flags.GroupIndex]=u,t.ret=u,null}return n.val},ce=function(e,n,t){var r=n.type;if(x===r){var a,l,u=n.val.length;if(-1!==(o=u?oe(0,n.val[0],t):0))for(a=1;a<u;a++){if(-1===(l=oe(0,n.val[a],t))){o=-1;break}l>o&&(o=l)}return u&&(t.ret=o),null}if(M===r)return n.val.length?n.val[0]:null;if(b===r)return-1===(o=oe(0,n.val,t))?t.ret=-1:0<o&&(-1===n.flags.max?t.ret=-1:0<n.flags.max?t.ret=n.flags.max*o:t.ret=o),null;if(S===r&&n.flags.GroupIndex){var o=oe(0,n.val,t);return t.group[n.flags.GroupIndex]=o,t.ret=o,null}return n.val},fe=function(e,n,t){var r=n.type;if(G===r){var a,l=[],u=0,o=n.val.length;for(u=0;u<o&&(a=n.val[u],l.push(a),b===a.type&&0===a.flags.min||O===a.type&&(a.flags.MatchStart||a.flags.MatchEnd));u++);return l.length?l:null}return n.val},he=function(e,n,t){if(null!=t.ret)return-1===t.ret?e=-1:e+=t.ret,e;if(-1===e)return e;if(n===+n)return e+=n;if(O===n.type&&n.flags.MatchEnd)return t.stop=1,e;var r=n.type;return I===r||E===r||N===r||k===r||O===r&&!n.flags.MatchStart&&!n.flags.MatchEnd?e+=n.flags.BackReference?t.group[n.flags.GroupIndex]||0:1:R===r&&(e+=n.val.length),e},ge=function(e,n,r){if(null!=r.ret)return e+=r.ret;if(t(n))return e+=n;if(O===n.type&&n.flags.MatchEnd)return r.stop=1,e;var a=n.type,l=null;if(I===a)l=n.val;else if(E===a){var u=[n.val[0],n.val[1]];N!==u[0].type&&k!==u[0].type||(u[0]=u[0].flags.Char),N!==u[1].type&&k!==u[1].type||(u[1]=u[1].flags.Char),l=$(u)}else if(N===a||k===a)l=[n.flags.Char];else if(O!==a||n.flags.MatchStart||n.flags.MatchEnd)R===a&&(l=n.val);else{var o=n.val;if(n.flags.BackReference)return e+=h.call(r.group,o)?r.group[o]:"";l="D"===o?[ee(!1)]:"W"===o?[te(!1)]:"S"===o?[K(!1)]:"d"===o?[ee()]:"w"===o?[te()]:"s"===o?[K()]:"."===o&&n.flags.MatchAnyChar?[re()]:[m+o]}return l&&(e+=R===a?r.isCaseInsensitive?ue(l):l:ae(r.isCaseInsensitive?ue(l,!0):l,!r.node||!r.node.flags.NegativeMatch)),e},ve=function(e,n,r){if(null!=r.ret)return r.ret.src&&(e.src+=r.ret.src),r.ret.group&&(e.group=a(r.ret.group,e.group)),e;if(t(n))return e.src+=n,e;var l=n.type;if(I===l)e.src+=r.escaped?D(n.val.join(""),m,1):n.val.join("");else if(E===l){var u=[n.val[0],n.val[1]];r.escaped?(N===u[0].type?u[0]="\\u"+U(u[0].flags.Code,4):k===u[0].type?u[0]="\\x"+U(u[0].flags.Code,2):u[0]=D(u[0],m,1),N===u[1].type?u[1]="\\u"+U(u[1].flags.Code,4):k===u[1].type?u[1]="\\x"+U(u[1].flags.Code,2):u[1]=D(u[1],m,1)):(N!==u[0].type&&k!==u[0].type||(u[0]=u[0].flags.Char),N!==u[1].type&&k!==u[1].type||(u[1]=u[1].flags.Char)),e.src+=u[0]+"-"+u[1]}else N===l?e.src+=r.escaped?"\\u"+U(n.flags.Code,4):n.flags.Char:k===l?e.src+=r.escaped?"\\x"+U(n.flags.Code,2):n.flags.Char:O===l?n.flags.BackReference?e.src+=m+n.val:e.src+=n.flags.MatchAnyChar||n.flags.MatchStart||n.flags.MatchEnd?""+n.val:m+n.val:R===l&&(e.src+=r.escaped?D(n.val,m):n.val);return e},de=function(e,n,t){if(null!=t.ret)return e.positive=P(e.positive,t.ret.positive),e.negative=P(e.negative,t.ret.negative),e;if(O===n.type&&n.flags.MatchEnd)return t.stop=1,e;var r=n.type,a=t.node&&M===t.node.type&&t.node.flags.NegativeMatch,l=a?"negative":"positive";if(I===r)e[l]=P(e[l],n.val);else if(E===r){var u=[n.val[0],n.val[1]];N!==u[0].type&&k!==u[0].type||(u[0]=u[0].flags.Char),N!==u[1].type&&k!==u[1].type||(u[1]=u[1].flags.Char),e[l]=P(e[l],$(u))}else if(N===r||k===r)e[l][n.flags.Char]=1;else if(O!==r||n.flags.BackReference||n.flags.MatchStart||n.flags.MatchEnd)R===r&&(e.positive[n.val[v](0)]=1);else{var o=n.val;"D"===o?e[a?"positive":"negative"]["\\d"]=1:"W"===o?e[a?"positive":"negative"]["\\w"]=1:"S"===o?e[a?"positive":"negative"]["\\s"]=1:"B"===o?e[a?"positive":"negative"]["\\b"]=1:e[l][m+o]=1}return e},me=function(e){var n=!1;return!!(e.length>2&&"x"===e[v](0)&&J(Z,e,1,2,2))&&[n=e.slice(0,3),n.slice(1)]},ye=function(e){var n=!1;return!!(e.length>4&&"u"===e[v](0)&&J(Z,e,1,4,4))&&[n=e.slice(0,5),n.slice(1)]},Ce=function(e){var n,t=e.length,r=0,a=!1,l=!1;return t>2&&"{"===e[v](r)&&(a=["","",null],r++,(n=X(" \t\v",e,r))&&(r+=n),!!(n=Y(T,e,r))&&(a[1]=e.slice(r,r+n),r+=n,(n=X(" \t\v",e,r))&&(r+=n),r<t&&","===e[v](r)&&(r+=1,l=!0),(n=X(" \t\v",e,r))&&(r+=n),(n=Y(T,e,r))&&(a[2]=e.slice(r,r+n),r+=n),(n=X(" \t\v",e,r))&&(r+=n),r<t&&"}"===e[v](r)&&(r++,a[0]=e.slice(0,r),l||(a[2]=a[1]),a)))},Ge=function(e){var n,t,r,a,l,o,s,i=[],p=[],c=[],f={},d=!1,y=!1;for("^"===e.re[v](e.pos)&&(f.NegativeMatch=1,e.pos++),r=e.len;e.pos<r;)if(s=!1,!1,o=null,a=t,t=e.re[v](e.pos++),(y=m===t)&&(t=e.re[v](e.pos++)),y&&("u"===t?(o=ye(e.re.substr(e.pos-1)),e.pos+=o[0].length-1,t=u(N,o[0],{Char:g(parseInt(o[1],16)),Code:o[1]}),s=!0,!1):"x"===t&&(o=me(e.re.substr(e.pos-1)),e.pos+=o[0].length-1,t=u(k,o[0],{Char:g(parseInt(o[1],16)),Code:o[1]}),s=!0,!0)),d)p.length&&(c=c.concat(p),p=[]),l[1]=t,d=!1,i.push(u(E,l));else if(y)s?(p.length&&(c=c.concat(p),p=[]),i.push(t)):h.call(C,t)&&"/"!==t?(p.length&&(c=c.concat(p),p=[]),(n={})[C[t]]=1,i.push(u(O,t,n))):p.push(t);else{if("]"===t)return p.length&&(c=c.concat(p),p=[]),c.length&&i.push(u(I,c)),u(M,i,f);"-"===t?(l=[a,""],a instanceof u?i.pop():p.pop(),d=!0):p.push(t)}return p.length&&(c=c.concat(p),p=[]),c.length&&i.push(u(I,c)),u(M,i,f)},xe=function e(n){var t,r,a,l,o,s,i,p="",c=0,f=[],d=[],M={},I=!1;if(n.inGroup>0){if(o=n.re.substr(n.pos,2),s=n.re.substr(n.pos,3),i=1,"?P="===s){for(M.BackReference=1,M.GroupName="",n.pos+=3,t=n.len;n.pos<t&&")"!==(r=n.re[v](n.pos++));)M.GroupName+=r;return M.GroupIndex=h.call(n.group,M.GroupName)?n.group[M.GroupName]:null,u(O,String(M.GroupIndex),M)}if("?#"===o){for(M.Comment=1,n.pos+=2,p="",t=n.len;n.pos<t&&")"!==(r=n.re[v](n.pos++));)p+=r;return u(A,p)}if("?:"===o)M.NotCaptured=1,n.pos+=2,i=0;else if("?="===o)M.LookAhead=1,n.pos+=2,i=0;else if("?!"===o)M.NegativeLookAhead=1,n.pos+=2,i=0;else if("?<="===s)M.LookBehind=1,n.pos+=3,i=0;else if("?<!"===s)M.NegativeLookBehind=1,n.pos+=3,i=0;else if("?<"===o||"?P<"===s)for(M.NamedGroup=1,M.GroupName="",n.pos+="?<"===o?2:3,t=n.len;n.pos<t&&">"!==(r=n.re[v](n.pos++));)M.GroupName+=r;++n.index,i&&(++n.groupIndex,M.GroupIndex=n.groupIndex,n.group[M.GroupIndex]=M.GroupIndex,M.GroupName&&(n.group[M.GroupName]=M.GroupIndex))}for(t=n.len;n.pos<t;)if(r=n.re[v](n.pos++),(I=m===r)&&(r=n.re[v](n.pos++)),I)if("u"===r)c&&(d.push(u(R,p)),p="",c=0),a=ye(n.re.substr(n.pos-1)),n.pos+=a[0].length-1,d.push(u(N,a[0],{Char:g(parseInt(a[1],16)),Code:a[1]}));else if("x"===r)c&&(d.push(u(R,p)),p="",c=0),a=me(n.re.substr(n.pos-1)),n.pos+=a[0].length-1,d.push(u(k,a[0],{Char:g(parseInt(a[1],16)),Code:a[1]}));else if(h.call(C,r)&&"/"!==r)c&&(d.push(u(R,p)),p="",c=0),(l={})[C[r]]=1,d.push(u(O,r,l));else if("1"<=r&&"9">=r){for(c&&(d.push(u(R,p)),p="",c=0),p=r;n.pos<t&&"0"<=(r=n.re[v](n.pos))&&"9">=r;)p+=r,n.pos++;(l={}).BackReference=1,l.GroupIndex=parseInt(p,10),d.push(u(O,p,l)),p=""}else p+=r,c+=1;else{if(n.inGroup>0&&")"===r)return c&&(d.push(u(R,p)),p="",c=0),f.length?(f.push(u(G,d)),d=[],l={},l[y["|"]]=1,u(S,u(x,f,l),M)):u(S,u(G,d),M);if("|"===r)c&&(d.push(u(R,p)),p="",c=0),f.push(u(G,d)),d=[];else if("["===r)c&&(d.push(u(R,p)),p="",c=0),d.push(Ge(n));else if("("===r)c&&(d.push(u(R,p)),p="",c=0),n.inGroup+=1,d.push(e(n)),n.inGroup-=1;else if("{"===r){c&&(d.push(u(R,p)),p="",c=0),a=Ce(n.re.substr(n.pos-1)),n.pos+=a[0].length-1,(l={val:a[0],MatchMinimum:a[1],MatchMaximum:a[2]||"unlimited",min:parseInt(a[1],10),max:a[2]?parseInt(a[2],10):-1})[y[r]]=1,n.pos<t&&"?"===n.re[v](n.pos)?(l.isGreedy=0,n.pos++):l.isGreedy=1;E=d.pop();R===E.type&&E.val.length>1&&(d.push(u(R,E.val.slice(0,-1))),E.val=E.val.slice(-1)),d.push(u(b,E,l))}else if("*"===r||"+"===r||"?"===r){c&&(d.push(u(R,p)),p="",c=0),(l={})[y[r]]=1,l.min="+"===r?1:0,l.max="?"===r?1:-1,n.pos<t&&"?"===n.re[v](n.pos)?(l.isGreedy=0,n.pos++):l.isGreedy=1;var E=d.pop();R===E.type&&E.val.length>1&&(d.push(u(R,E.val.slice(0,-1))),E.val=E.val.slice(-1)),d.push(u(b,E,l))}else h.call(y,r)?(c&&(d.push(u(R,p)),p="",c=0),(l={})[y[r]]=1,d.push(u(O,r,l))):(p+=r,c+=1)}return c&&(d.push(u(R,p)),p="",c=0),f.length?(f.push(u(G,d)),d=[],l={},M[y["|"]]=1,u(x,f,l)):u(G,d)};o.VERSION="1.1.0",o[i]={constructor:o,ast:null,re:null,fl:null,src:null,grp:null,min:null,max:null,ch:null,dispose:function(){var e=this;return e.ast=null,e.re=null,e.fl=null,e.src=null,e.grp=null,e.min=null,e.max=null,e.ch=null,e},reset:function(){var e=this;return e.ast=null,e.src=null,e.grp=null,e.min=null,e.max=null,e.ch=null,e},input:function(e,n){var t=this;if(!arguments.length)return t.re;if(e){n=!1!==n&&(n||"/");var r,a,l={};if(e=e.toString(),r=e.length,n){for(;0<r&&(a=e[v](r-1),n!==a);)l[a]=1,r--;e=0<r?n===e[v](0)&&n===e[v](r-1)?e.slice(1,r-1):e.slice(0,r):""}t.re!==e&&t.reset(),t.re=e,t.fl=l}return t},analyze:function(){var e=this;if(null!=e.re&&null===e.ast){var n=new l(e.re);e.ast=xe(n),n.dispose()}return e},synthesize:function(e){var n,t,r=this;return null==r.re?r:(null===r.ast&&(r.analyze(),r.src=null,r.grp=null),null===r.src&&(n={MAP:G|x|S|M|b,REDUCE:N|k|O|I|E|R,IGNORE:A,map:se,reduce:ve,escaped:!1!==e,group:{}},t=oe({src:"",group:{}},r.ast,n),r.src=t.src,r.grp=t.group),r)},source:function(){var e=this;return null==e.re?null:(null===e.src&&e.synthesize(),e.src)},groups:function(e){var n=this;return null==n.re?null:(null===n.grp&&n.synthesize(),!0===e?sel.grp:a(n.grp))},compile:function(e){var n=this;return null==n.re?null:(e=e||n.fl||{},new RegExp(n.source(),(e.g||e.G?"g":"")+(e.i||e.I?"i":"")+(e.m||e.M?"m":"")+(e.y||e.Y?"y":"")))},tree:function(e){var n=this;return null==n.re?null:(null===n.ast&&n.analyze(),!0===e?n.ast.toObject():n.ast)},sample:function(e,n){var t,r=this;if(null==r.re)return null;if(null===r.ast&&r.analyze(),t={MAP:G|x|S|M|b,REDUCE:N|k|O|I|E|R,IGNORE:A,map:ie,reduce:ge,maxLength:0|e||1,isCaseInsensitive:null!=r.fl.i,group:{}},1<(n=0|n||1)){for(var a=new Array(n),l=0;l<n;l++)a[l]=oe("",r.ast,t);return a}return oe("",r.ast,t)},minimum:function(){var e,n=this;return null==n.re?0:(null===n.ast&&(n.analyze(),n.min=null),null===n.min&&(e={MAP:G|x|S|M|b,REDUCE:N|k|O|I|E|R,IGNORE:A,map:pe,reduce:he,group:{}},n.min=0|oe(0,n.ast,e)),n.min)},maximum:function(){var e,n=this;return null==n.re?0:(null===n.ast&&(n.analyze(),n.max=null),null===n.max&&(e={MAP:G|x|S|M|b,REDUCE:N|k|O|I|E|R,IGNORE:A,map:ce,reduce:he,group:{}},n.max=oe(0,n.ast,e)),n.max)},peek:function(){var e,n,t,r,l,u,o,s=this;if(null==s.re)return null;null===s.ast&&(s.analyze(),s.ch=null),null===s.ch&&(e={MAP:G|x|S|M|b,REDUCE:N|k|O|I|E|R,IGNORE:A,map:fe,reduce:de,group:{}},s.ch=oe({positive:{},negative:{}},s.ast,e)),t={positive:a(s.ch.positive),negative:a(s.ch.negative)},n=null!=s.fl.i;for(r in t){o={},u=t[r];for(l in u)"\\d"===l?(delete u[l],o=P(o,$("0","9"))):"\\s"===l?(delete u[l],o=P(o,["\f","\n","\r","\t","\v"," ","\u2028","\u2029"])):"\\w"===l?(delete u[l],o=P(o,["_"].concat($("0","9")).concat($("a","z")).concat($("A","Z")))):"\\b"===l?(delete u[l],o[y.b]=1):"\\."===l?(delete u[l],o[y["."]]=1):m!==l[v](0)&&n?(o[l.toLowerCase()]=1,o[l.toUpperCase()]=1):m===l[v](0)&&delete u[l];t[r]=P(u,o)}return t}},o[i].set=o[i].input,s.VERSION="1.1.0",s[i]={constructor:s,re:null,g:0,grp:null,level:0,ast:null,dispose:function(){var e=this;return e.re=null,e.g=null,e.grp=null,e.level=null,e.ast=null,e},reset:function(){var e=this;return e.g=0,e.grp={},e.level=0,e.ast=[{node:[],type:G,flag:""}],e},compose:function(){var e=this,n=B(arguments).join(""),t=e.ast[0].node.join("");return e.re={source:t,flags:n,groups:e.grp,pattern:j(t,n)},e.reset(),e.re},partial:function(e){var n=this,t=n.ast[0].node.join("");return!1!==e&&n.reset(),t},token:function(e,n){var t=this;return null!=e&&t.ast[t.level].node.push(n?D(String(e),m):String(e)),t},literal:function(e){return this.token(String(e),!0)},regexp:function(e){return this.token(String(e),!1)},SOL:function(){var e=this;return e.ast[e.level].node.push("^"),e},SOF:function(){return this.SOL()},EOL:function(){var e=this;return e.ast[e.level].node.push("$"),e},EOF:function(){return this.EOL()},LF:function(){var e=this;return e.ast[e.level].node.push("\\n"),e},CR:function(){var e=this;return e.ast[e.level].node.push("\\r"),e},TAB:function(){var e=this;return e.ast[e.level].node.push("\\t"),e},CTRL:function(e){var n=this;return n.ast[n.level].node.push("\\c"+(e||0)),n},HEX:function(e){var n=this;return n.ast[n.level].node.push("\\x"+U(e||0,2)),n},UNICODE:function(e){var n=this;return n.ast[n.level].node.push("\\u"+U(e||0,4)),n},backSpace:function(){var e=this;return e.ast[e.level].node.push("[\\b]"),e},any:function(e){var n=this;return n.ast[n.level].node.push(e?"[\\s\\S]":"."),n},space:function(e){var n=this;return arguments.length<1&&(e=!0),n.ast[n.level].node.push(e?"\\s":"\\S"),n},digit:function(e){var n=this;return arguments.length<1&&(e=!0),n.ast[n.level].node.push(e?"\\d":"\\D"),n},word:function(e){var n=this;return arguments.length<1&&(e=!0),n.ast[n.level].node.push(e?"\\w":"\\W"),n},boundary:function(e){var n=this;return arguments.length<1&&(e=!0),n.ast[n.level].node.push(e?"\\b":"\\B"),n},characters:function(){var e=this;return M===e.ast[e.level].type&&e.ast[e.level].node.push(z(arguments).map(function(e){return D(String(e),m,1)}).join("")),e},range:function(e,n){var t=this;return null!=e&&null!=n&&M===t.ast[t.level].type&&t.ast[t.level].node.push(D(String(e),m,1)+"-"+D(String(n),m,1)),t},backReference:function(e){var n=this;return n.ast[n.level].node.push(m+(h.call(n.grp,e)?n.grp[e]:0|e)),n},repeat:function(e,n,t){var r=this;if(null==e)return r;arguments.length<3&&(t=!0);var a=(null==n||e===n?"{"+String(e)+"}":"{"+String(e)+","+String(n)+"}")+(t?"":"?");return r.ast[r.level].node[r.ast[r.level].node.length-1]+=a,r},zeroOrOne:function(e){var n=this;return arguments.length<3&&(e=!0),n.ast[n.level].node[n.ast[n.level].node.length-1]+=e?"?":"??",n},zeroOrMore:function(e){var n=this;return arguments.length<3&&(e=!0),n.ast[n.level].node[n.ast[n.level].node.length-1]+=e?"*":"*?",n},oneOrMore:function(e){var n=this;return arguments.length<3&&(e=!0),n.ast[n.level].node[n.ast[n.level].node.length-1]+=e?"+":"+?",n},alternate:function(){var e=this;return e.level++,e.ast.push({node:[],type:x,flag:"",sequences:[]}),e},either:function(){return this.alternate()},or_:function(){var e=this,n=e.ast[e.level];return x===n.type&&n.node.length&&(n.sequences.push(n.node.join("")),n.node=[]),e},group:function(e,n){var r=this,a=S,l="";return t(e)?(l=e,(e={})[l]=n,l=""):e=e||{},e.name||e.named?(r.g++,r.grp[r.g]=r.g,r.grp[e.name||e.named]=r.g):!0===e.lookahead||!1===e.lookahead?l=!1===e.lookahead?"?!":"?=":!0===e.lookbehind||!1===e.lookbehind?l=!1===e.lookbehind?"?<!":"?<=":!0===e.nocapture?l="?:":!0===e.characters||!1===e.characters?(a=M,l=!1===e.characters?"^":""):(r.g++,r.grp[r.g]=r.g),r.level++,r.ast.push({node:[],type:a,flag:l}),r},subGroup:function(e){return this.group(e)},characterGroup:function(e){return this.group({characters:!1!==e})},namedGroup:function(e){return this.group({name:e})},nonCaptureGroup:function(){return this.group({nocapture:!0})},lookAheadGroup:function(e){return this.group({lookahead:!1!==e})},lookBehindGroup:function(e){return this.group({lookbehind:!1!==e})},end:function(e){var n,t,r,a,l,u=this;for(e=(arguments.length?0|e:1)||1;e--;)t=(n=u.ast.length?u.ast.pop():null)?n.type:0,r=n?n.flag:"",a=n?n.node:[],x===t&&(l=n?n.sequences:[],a=a.length?l.concat(a.join("")):l),0<u.level&&(--u.level,x===t?u.ast[u.level].node.push(a.join("|")):S===t?u.ast[u.level].node.push("("+r+a.join("")+")"):M===t?u.ast[u.level].node.push("["+r+a.join("")+"]"):u.ast[u.level].node.push(a.join("")));return u}};var Se=s[i];return Se.startOfLine=Se.SOL,Se.endOfLine=Se.EOL,Se.startOfInput=Se.SOF,Se.endOfInput=Se.EOF,Se.match=Se.token,Se.sub=Se.regexp,Se.lineFeed=Se.LF,Se.carriageReturn=Se.CR,Se.tabulate=Se.TAB,Se.wordBoundary=Se.boundary,Se.chars=Se.characters,Se.charGroup=Se.characterGroup,Se.namedSubGroup=Se.namedGroup,Se.nonCaptureSubGroup=Se.nonCaptureGroup,Se.lookAheadSubGroup=Se.lookAheadGroup,Se.lookBehindSubGroup=Se.lookBehindGroup,{VERSION:"1.1.0",Node:u,Analyzer:o,Composer:s}});

For more information send a message to info at phpclasses dot org.