From dd2551439ef078265af8ef89a4c02a3b8719354b Mon Sep 17 00:00:00 2001 From: Mihai Ionut Vilcu Date: Fri, 7 Dec 2018 12:04:46 +0200 Subject: [PATCH] Released 1.0.0 --- .npmignore | 3 ++- dist/verbalexpressions.js.map | 2 +- dist/verbalexpressions.min.js.map | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.npmignore b/.npmignore index a3f3d150..ea3f4395 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,6 @@ +.vscode verbal_expressions.py verbal_expressions.rb VerbalExpressions.groovy VerbalExpressions.java -VerbalExpressions.php \ No newline at end of file +VerbalExpressions.php diff --git a/dist/verbalexpressions.js.map b/dist/verbalexpressions.js.map index 846f2fc8..feb071e0 100644 --- a/dist/verbalexpressions.js.map +++ b/dist/verbalexpressions.js.map @@ -1 +1 @@ -{"version":3,"sources":["../VerbalExpressions.js"],"names":["VerbalExpression","_prefixes","_source","_suffixes","_modifiers","value","pattern","compile","enable","add","sanitize","then","Array","isArray","join","anyOf","i","length","from","to","lineBreak","modifier","includes","replace","addModifier","removeModifier","isInteger","quantity","values","filter","test","argument","lower","upper","undefined","slice","source","toString","components","match","flags","RegExp","toEscape","lastMatch","VerEx","instance"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AAQA;;;;;;IAMMA,gB;;;AACF;;;;;;AAMA,gCAAc;AAAA;;AAIV;AAJU,wIAEJ,EAFI,EAEA,IAFA;AACV;;;AAIA,cAAKC,SAAL,GAAiB,EAAjB;AACA,cAAKC,OAAL,GAAe,EAAf;AACA,cAAKC,SAAL,GAAiB,EAAjB;AACA,cAAKC,UAAL,GAAkB,IAAlB,CARU,CAQc;AARd;AASb;;AAED;;AAEA;;;;;;;;;;;;;AA2BA;;;;;;8BAMgB;AAAA,gBAAZC,KAAY,uEAAJ,EAAI;;AACZ,iBAAKH,OAAL,IAAgBG,KAAhB;AACA,gBAAMC,UAAU,KAAKL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,GAAL,CAAS,GAAT,CAAP;AACH;;AAED;;;;;;;;qCAKa;AACT;AACA,iBAAKN,SAAL,GAAiB,KAAKA,SAAL,CAAegC,KAAf,CAAqB,CAArB,EAAwB,CAAC,CAAzB,CAAjB;AACA,mBAAO,KAAK1B,GAAL,CAAS,GAAT,CAAP;AACH;;AAED;;AAEA;;;;;;;;;;gCAOQ2B,M,EAAQ/B,K,EAAO;AACnB+B,qBAASA,OAAOC,QAAP,EAAT;AACA,mBAAOD,OAAOb,OAAP,CAAe,IAAf,EAAqBlB,KAArB,CAAP;AACH;;AAED;;;;;;;;mCAKW;AACP,gBAAMiC,aAAa,KAAKD,QAAL,GAAgBE,KAAhB,CAAsB,qBAAtB,CAAnB;AACA,gBAAMjC,UAAUgC,WAAW,CAAX,CAAhB;AACA,gBAAME,QAAQF,WAAW,CAAX,CAAd;;AAEA,mBAAO,IAAIG,MAAJ,CAAWnC,OAAX,EAAoBkC,KAApB,CAAP;AACH;;;iCAhbenC,K,EAAO;AACnB,gBAAIA,MAAM+B,MAAV,EAAkB;AACd,uBAAO/B,MAAM+B,MAAb;AACH;;AAED,gBAAI,OAAO/B,KAAP,KAAiB,QAArB,EAA+B;AAC3B,uBAAOA,KAAP;AACH;;AAED;AACA;AACA,gBAAMqC,WAAW,yBAAjB;;AAEA;AACA,gBAAMC,YAAY,IAAlB;;AAEA;AACA,mBAAOtC,MAAMkB,OAAN,CAAcmB,QAAd,SAA6BC,SAA7B,CAAP;AACH;;;;qBA7C0BF,M;;AA8c/B;;;;;;;AAKA,SAASG,KAAT,GAAiB;AAAE;AACf,QAAMC,WAAW,IAAI7C,gBAAJ,EAAjB;AACA6C,aAASnC,QAAT,GAAoBV,iBAAiBU,QAArC;AACA,WAAOmC,QAAP;AACH","file":"verbalexpressions.js","sourcesContent":["/**\n * @file VerbalExpressions JavaScript Library\n * @version 0.3.0\n * @license MIT\n *\n * @see https://github.com/VerbalExpressions/JSVerbalExpressions\n */\n\n/**\n * Define the VerbalExpression class\n *\n * @class VerbalExpression\n * @extends {RegExp}\n */\nclass VerbalExpression extends RegExp {\n /**\n * Creates an instance of VerbalExpression.\n * @constructor\n * @alias VerEx\n * @memberof VerbalExpression\n */\n constructor() {\n // Call the `RegExp` constructor so that `this` can be used\n super('', 'gm');\n\n // Variables to hold the expression construction in order\n this._prefixes = '';\n this._source = '';\n this._suffixes = '';\n this._modifiers = 'gm'; // 'global, multiline' matching by default\n }\n\n // Utility //\n\n /**\n * Escape meta-characters in the parameter and make it safe for adding to the expression\n * @static\n * @param {(string|RegExp|number)} value object to sanitize\n * @returns {string} sanitized value\n * @memberof VerbalExpression\n */\n static sanitize(value) {\n if (value.source) {\n return value.source;\n }\n\n if (typeof value === 'number') {\n return value;\n }\n\n // Regular expression to match meta characters\n // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/regexp\n const toEscape = /([\\].|*?+(){}^$\\\\:=[])/g;\n\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch\n const lastMatch = '$&';\n\n // Escape meta characters\n return value.replace(toEscape, `\\\\${lastMatch}`);\n }\n\n /**\n * Add stuff to the expression and compile the new expression so it's ready to be used.\n * @param {(string|number)} [value=''] stuff to add\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n add(value = '') {\n this._source += value;\n const pattern = this._prefixes + this._source + this._suffixes;\n\n this.compile(pattern, this._modifiers);\n\n return this;\n }\n\n // Rules //\n\n /**\n * Control start-of-line matching\n * @param {boolean} [enable=true] whether to enable this behaviour\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n startOfLine(enable = true) {\n this._prefixes = enable ? '^' : '';\n return this.add();\n }\n\n /**\n * Control end-of-line matching\n * @param {boolean} [enable=true] whether to enable this behaviour\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n endOfLine(enable = true) {\n this._suffixes = enable ? '$' : '';\n return this.add();\n }\n\n /**\n * Look for the value passed\n * @param {(string|RegExp|number)} value value to find\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n then(value) {\n value = VerbalExpression.sanitize(value);\n return this.add(`(?:${value})`);\n }\n\n /**\n * Alias for then() to allow for readable syntax when then() is the first method in the chain.\n * @param {(string|RegExp|numer)} value value to find\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n find(value) {\n return this.then(value);\n }\n\n /**\n * Add optional values\n * @param {(string|RegExp|number)} value value to find\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n maybe(value) {\n value = VerbalExpression.sanitize(value);\n return this.add(`(?:${value})?`);\n }\n\n /**\n * Add alternative expressions\n * @param {(string|RegExp|number)} value value to find\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n or(value) {\n this._prefixes += '(?:';\n this._suffixes = `)${this._suffixes}`;\n\n this.add(')|(?:');\n\n if (value) {\n this.then(value);\n }\n\n return this;\n }\n\n /**\n * Any character any number of times\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n anything() {\n return this.add('(?:.*)');\n }\n\n /**\n * Anything but these characters\n * @param {(string|number|string[]|number[])} value characters to not match\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n anythingBut(value) {\n if (Array.isArray(value)) {\n value = value.join('');\n }\n\n value = VerbalExpression.sanitize(value);\n return this.add(`(?:[^${value}]*)`);\n }\n\n /**\n * Any character(s) at least once\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n something() {\n return this.add('(?:.+)');\n }\n\n /**\n * Any character at least one time except for these characters\n * @param {(string|number|string[]|number[])} value characters to not match\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n somethingBut(value) {\n if (Array.isArray(value)) {\n value = value.join('');\n }\n\n value = VerbalExpression.sanitize(value);\n return this.add(`(?:[^${value}]+)`);\n }\n\n /**\n * Match any of the given characters\n * @param {(string|number|string[]|number[])} value characters to match\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n anyOf(value) {\n if (Array.isArray(value)) {\n value = value.join('');\n }\n\n value = VerbalExpression.sanitize(value);\n return this.add(`[${value}]`);\n }\n\n /**\n * Shorthand for anyOf(value)\n * @param {string|number} value value to find\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n any(value) {\n return this.anyOf(value);\n }\n\n /**\n * Ensure that the parameter does not follow\n * @param {string|number} value\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n not(value) {\n value = VerbalExpression.sanitize(value);\n this.add(`(?!${value})`);\n\n return this;\n }\n\n /**\n * Matching any character within a range of characters\n * Usage: .range( from, to [, from, to ... ] )\n * @param {...string} ranges characters denoting beginning and ending of ranges\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n range(...ranges) {\n let value = '';\n\n for (let i = 1; i < ranges.length; i += 2) {\n const from = VerbalExpression.sanitize(ranges[i - 1]);\n const to = VerbalExpression.sanitize(ranges[i]);\n\n value += `${from}-${to}`;\n }\n\n return this.add(`[${value}]`);\n }\n\n // Special characters //\n\n /**\n * Match a Line break\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n lineBreak() {\n return this.add('(?:\\\\r\\\\n|\\\\r|\\\\n)'); // Unix(LF) + Windows(CRLF)\n }\n\n /**\n * A shorthand for lineBreak() for html-minded users\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n br() {\n return this.lineBreak();\n }\n\n /**\n * Match a tab character\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n tab() {\n return this.add('\\\\t');\n }\n\n /**\n * Match any alphanumeric\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n word() {\n return this.add('\\\\w+');\n }\n\n /**\n * Match a single digit\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n digit() {\n return this.add('\\\\d');\n }\n\n /**\n * Match a single whitespace\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n whitespace() {\n return this.add('\\\\s');\n }\n\n // Modifiers //\n\n /**\n * Add a regex modifier/flag\n * @param {string} modifier modifier to add\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n addModifier(modifier) {\n if (!this._modifiers.includes(modifier)) {\n this._modifiers += modifier;\n }\n\n return this.add();\n }\n\n /**\n * Remove modifier\n * @param {string} modifier modifier to remove\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n removeModifier(modifier) {\n this._modifiers = this._modifiers.replace(modifier, '');\n return this.add();\n }\n\n /**\n * Control case-insensitive matching\n * @param {boolean} [enable=true] whether to enable this behaviour\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n withAnyCase(enable = true) {\n return enable ? this.addModifier('i') : this.removeModifier('i');\n }\n\n /**\n * Default behaviour is with \"g\" modifier, so we can turn this another way around than other modifiers\n * @param {boolean} [enable=true] whether to enable this behaviour\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n stopAtFirst(enable = true) {\n return enable ? this.removeModifier('g') : this.addModifier('g');\n }\n\n /**\n * Control the multiline modifier\n * @param {boolean} [enable=true] whether to enable this behaviour\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n searchOneLine(enable = true) {\n return enable ? this.removeModifier('m') : this.addModifier('m');\n }\n\n // Loops //\n\n /**\n * Repeat the previous item exactly n times or between n and m times\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n repeatPrevious(...quantity) {\n const isInteger = /\\d+/;\n const values = quantity.filter(argument => isInteger.test(argument));\n\n if (values.length === 0 || values.length > 2) {\n return this;\n }\n\n this.add(`{${values.join(',')}}`);\n\n return this;\n }\n\n /**\n * Repeat the previous at least once\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n oneOrMore() {\n return this.add('+');\n }\n\n /**\n * Match the value zero or more times\n * @param {string} value value to find\n * @param {integer} [lower] minimum number of times the value should be repeated\n * @param {integer} [upper] maximum number of times the value should be repeated\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n multiple(value, lower, upper) {\n if (value !== undefined) {\n value = VerbalExpression.sanitize(value);\n this.add(`(?:${value})`);\n }\n\n if (lower === undefined && upper === undefined) {\n this.add('*'); // Any number of times\n } else if (lower !== undefined && upper === undefined) {\n this.add(`{${lower},}`);\n } else if (lower !== undefined && upper !== undefined) {\n this.add(`{${lower},${upper}}`);\n }\n\n return this;\n }\n\n // Capture groups //\n\n /**\n * Starts a capturing group\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n beginCapture() {\n // Add the end of the capture group to the suffixes temporarily so that compilation continues to work\n this._suffixes += ')';\n return this.add('(');\n }\n\n /**\n * Ends a capturing group\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n endCapture() {\n // Remove the last parenthesis from the _suffixes and add it to the regex\n this._suffixes = this._suffixes.slice(0, -1);\n return this.add(')');\n }\n\n // Miscellaneous //\n\n /**\n * Shorthand function for the string.replace function to allow for a more logical flow\n * @param {string} source string to search for\n * @param {string} value value to replace with\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\n * @memberof VerbalExpression\n */\n replace(source, value) {\n source = source.toString();\n return source.replace(this, value);\n }\n\n /**\n * Convert to RegExp object\n * @returns {RegExp} equivalent RegExp instance\n * @memberof VerbalExpression\n */\n toRegExp() {\n const components = this.toString().match(/\\/(.*)\\/([gimuy]+)?/);\n const pattern = components[1];\n const flags = components[2];\n\n return new RegExp(pattern, flags);\n }\n}\n\n/**\n * Return a new instance of `VerbalExpression`\n * @export\n * @returns {VerbalExpression} new instance\n */\nfunction VerEx() { // eslint-disable-line no-unused-vars\n const instance = new VerbalExpression();\n instance.sanitize = VerbalExpression.sanitize;\n return instance;\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../VerbalExpressions.js"],"names":["VerbalExpression","_prefixes","_source","_suffixes","_modifiers","value","pattern","compile","enable","add","sanitize","then","Array","isArray","join","anyOf","i","length","from","to","lineBreak","modifier","includes","replace","addModifier","removeModifier","isInteger","quantity","values","filter","test","argument","lower","upper","undefined","slice","source","toString","components","match","flags","RegExp","toEscape","lastMatch","VerEx","instance"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AAQA;;;;;;IAMMA,gB;;;AACF;;;;;;AAMA,gCAAc;AAAA;;AAIV;AAJU,wIAEJ,EAFI,EAEA,IAFA;AACV;;;AAIA,cAAKC,SAAL,GAAiB,EAAjB;AACA,cAAKC,OAAL,GAAe,EAAf;AACA,cAAKC,SAAL,GAAiB,EAAjB;AACA,cAAKC,UAAL,GAAkB,IAAlB,CARU,CAQc;AARd;AASb;;AAED;;AAEA;;;;;;;;;;;;;AA2BA;;;;;;8BAMgB;AAAA,gBAAZC,KAAY,uEAAJ,EAAI;;AACZ,iBAAKH,OAAL,IAAgBG,KAAhB;AACA,gBAAMC,UAAU,KAAKL,SAAL,GAAiB,KAAKC,OAAtB,GAAgC,KAAKC,SAArD;;AAEA,iBAAKI,OAAL,CAAaD,OAAb,EAAsB,KAAKF,UAA3B;;AAEA,mBAAO,IAAP;AACH;;AAED;;AAEA;;;;;;;;;sCAM2B;AAAA,gBAAfI,MAAe,uEAAN,IAAM;;AACvB,iBAAKP,SAAL,GAAiBO,SAAS,GAAT,GAAe,EAAhC;AACA,mBAAO,KAAKC,GAAL,EAAP;AAC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AAT;AACA,mBAAOD,OAAOb,OAAP,CAAe,IAAf,EAAqBlB,KAArB,CAAP;AACH;;AAED;;;;;;;;mCAKW;AACP,gBAAMiC,aAAa,KAAKD,QAAL,GAAgBE,KAAhB,CAAsB,qBAAtB,CAAnB;AACA,gBAAMjC,UAAUgC,WAAW,CAAX,CAAhB;AACA,gBAAME,QAAQF,WAAW,CAAX,CAAd;;AAEA,mBAAO,IAAIG,MAAJ,CAAWnC,OAAX,EAAoBkC,KAApB,CAAP;AACH;;;iCAhbenC,K,EAAO;AACnB,gBAAIA,MAAM+B,MAAV,EAAkB;AACd,uBAAO/B,MAAM+B,MAAb;AACH;;AAED,gBAAI,OAAO/B,KAAP,KAAiB,QAArB,EAA+B;AAC3B,uBAAOA,KAAP;AACH;;AAED;AACA;AACA,gBAAMqC,WAAW,yBAAjB;;AAEA;AACA,gBAAMC,YAAY,IAAlB;;AAEA;AACA,mBAAOtC,MAAMkB,OAAN,CAAcmB,QAAd,SAA6BC,SAA7B,CAAP;AACH;;;;qBA7C0BF,M;;AA8c/B;;;;;;;AAKA,SAASG,KAAT,GAAiB;AAAE;AACf,QAAMC,WAAW,IAAI7C,gBAAJ,EAAjB;AACA6C,aAASnC,QAAT,GAAoBV,iBAAiBU,QAArC;AACA,WAAOmC,QAAP;AACH","file":"verbalexpressions.js","sourcesContent":["/**\r\n * @file VerbalExpressions JavaScript Library\r\n * @version 0.3.0\r\n * @license MIT\r\n *\r\n * @see https://github.com/VerbalExpressions/JSVerbalExpressions\r\n */\r\n\r\n/**\r\n * Define the VerbalExpression class\r\n *\r\n * @class VerbalExpression\r\n * @extends {RegExp}\r\n */\r\nclass VerbalExpression extends RegExp {\r\n /**\r\n * Creates an instance of VerbalExpression.\r\n * @constructor\r\n * @alias VerEx\r\n * @memberof VerbalExpression\r\n */\r\n constructor() {\r\n // Call the `RegExp` constructor so that `this` can be used\r\n super('', 'gm');\r\n\r\n // Variables to hold the expression construction in order\r\n this._prefixes = '';\r\n this._source = '';\r\n this._suffixes = '';\r\n this._modifiers = 'gm'; // 'global, multiline' matching by default\r\n }\r\n\r\n // Utility //\r\n\r\n /**\r\n * Escape meta-characters in the parameter and make it safe for adding to the expression\r\n * @static\r\n * @param {(string|RegExp|number)} value object to sanitize\r\n * @returns {string} sanitized value\r\n * @memberof VerbalExpression\r\n */\r\n static sanitize(value) {\r\n if (value.source) {\r\n return value.source;\r\n }\r\n\r\n if (typeof value === 'number') {\r\n return value;\r\n }\r\n\r\n // Regular expression to match meta characters\r\n // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/regexp\r\n const toEscape = /([\\].|*?+(){}^$\\\\:=[])/g;\r\n\r\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastMatch\r\n const lastMatch = '$&';\r\n\r\n // Escape meta characters\r\n return value.replace(toEscape, `\\\\${lastMatch}`);\r\n }\r\n\r\n /**\r\n * Add stuff to the expression and compile the new expression so it's ready to be used.\r\n * @param {(string|number)} [value=''] stuff to add\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n add(value = '') {\r\n this._source += value;\r\n const pattern = this._prefixes + this._source + this._suffixes;\r\n\r\n this.compile(pattern, this._modifiers);\r\n\r\n return this;\r\n }\r\n\r\n // Rules //\r\n\r\n /**\r\n * Control start-of-line matching\r\n * @param {boolean} [enable=true] whether to enable this behaviour\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n startOfLine(enable = true) {\r\n this._prefixes = enable ? '^' : '';\r\n return this.add();\r\n }\r\n\r\n /**\r\n * Control end-of-line matching\r\n * @param {boolean} [enable=true] whether to enable this behaviour\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n endOfLine(enable = true) {\r\n this._suffixes = enable ? '$' : '';\r\n return this.add();\r\n }\r\n\r\n /**\r\n * Look for the value passed\r\n * @param {(string|RegExp|number)} value value to find\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n then(value) {\r\n value = VerbalExpression.sanitize(value);\r\n return this.add(`(?:${value})`);\r\n }\r\n\r\n /**\r\n * Alias for then() to allow for readable syntax when then() is the first method in the chain.\r\n * @param {(string|RegExp|numer)} value value to find\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n find(value) {\r\n return this.then(value);\r\n }\r\n\r\n /**\r\n * Add optional values\r\n * @param {(string|RegExp|number)} value value to find\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n maybe(value) {\r\n value = VerbalExpression.sanitize(value);\r\n return this.add(`(?:${value})?`);\r\n }\r\n\r\n /**\r\n * Add alternative expressions\r\n * @param {(string|RegExp|number)} value value to find\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n or(value) {\r\n this._prefixes += '(?:';\r\n this._suffixes = `)${this._suffixes}`;\r\n\r\n this.add(')|(?:');\r\n\r\n if (value) {\r\n this.then(value);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Any character any number of times\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n anything() {\r\n return this.add('(?:.*)');\r\n }\r\n\r\n /**\r\n * Anything but these characters\r\n * @param {(string|number|string[]|number[])} value characters to not match\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n anythingBut(value) {\r\n if (Array.isArray(value)) {\r\n value = value.join('');\r\n }\r\n\r\n value = VerbalExpression.sanitize(value);\r\n return this.add(`(?:[^${value}]*)`);\r\n }\r\n\r\n /**\r\n * Any character(s) at least once\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n something() {\r\n return this.add('(?:.+)');\r\n }\r\n\r\n /**\r\n * Any character at least one time except for these characters\r\n * @param {(string|number|string[]|number[])} value characters to not match\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n somethingBut(value) {\r\n if (Array.isArray(value)) {\r\n value = value.join('');\r\n }\r\n\r\n value = VerbalExpression.sanitize(value);\r\n return this.add(`(?:[^${value}]+)`);\r\n }\r\n\r\n /**\r\n * Match any of the given characters\r\n * @param {(string|number|string[]|number[])} value characters to match\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n anyOf(value) {\r\n if (Array.isArray(value)) {\r\n value = value.join('');\r\n }\r\n\r\n value = VerbalExpression.sanitize(value);\r\n return this.add(`[${value}]`);\r\n }\r\n\r\n /**\r\n * Shorthand for anyOf(value)\r\n * @param {string|number} value value to find\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n any(value) {\r\n return this.anyOf(value);\r\n }\r\n\r\n /**\r\n * Ensure that the parameter does not follow\r\n * @param {string|number} value\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n not(value) {\r\n value = VerbalExpression.sanitize(value);\r\n this.add(`(?!${value})`);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Matching any character within a range of characters\r\n * Usage: .range( from, to [, from, to ... ] )\r\n * @param {...string} ranges characters denoting beginning and ending of ranges\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n range(...ranges) {\r\n let value = '';\r\n\r\n for (let i = 1; i < ranges.length; i += 2) {\r\n const from = VerbalExpression.sanitize(ranges[i - 1]);\r\n const to = VerbalExpression.sanitize(ranges[i]);\r\n\r\n value += `${from}-${to}`;\r\n }\r\n\r\n return this.add(`[${value}]`);\r\n }\r\n\r\n // Special characters //\r\n\r\n /**\r\n * Match a Line break\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n lineBreak() {\r\n return this.add('(?:\\\\r\\\\n|\\\\r|\\\\n)'); // Unix(LF) + Windows(CRLF)\r\n }\r\n\r\n /**\r\n * A shorthand for lineBreak() for html-minded users\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n br() {\r\n return this.lineBreak();\r\n }\r\n\r\n /**\r\n * Match a tab character\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n tab() {\r\n return this.add('\\\\t');\r\n }\r\n\r\n /**\r\n * Match any alphanumeric\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n word() {\r\n return this.add('\\\\w+');\r\n }\r\n\r\n /**\r\n * Match a single digit\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n digit() {\r\n return this.add('\\\\d');\r\n }\r\n\r\n /**\r\n * Match a single whitespace\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n whitespace() {\r\n return this.add('\\\\s');\r\n }\r\n\r\n // Modifiers //\r\n\r\n /**\r\n * Add a regex modifier/flag\r\n * @param {string} modifier modifier to add\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n addModifier(modifier) {\r\n if (!this._modifiers.includes(modifier)) {\r\n this._modifiers += modifier;\r\n }\r\n\r\n return this.add();\r\n }\r\n\r\n /**\r\n * Remove modifier\r\n * @param {string} modifier modifier to remove\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n removeModifier(modifier) {\r\n this._modifiers = this._modifiers.replace(modifier, '');\r\n return this.add();\r\n }\r\n\r\n /**\r\n * Control case-insensitive matching\r\n * @param {boolean} [enable=true] whether to enable this behaviour\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n withAnyCase(enable = true) {\r\n return enable ? this.addModifier('i') : this.removeModifier('i');\r\n }\r\n\r\n /**\r\n * Default behaviour is with \"g\" modifier, so we can turn this another way around than other modifiers\r\n * @param {boolean} [enable=true] whether to enable this behaviour\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n stopAtFirst(enable = true) {\r\n return enable ? this.removeModifier('g') : this.addModifier('g');\r\n }\r\n\r\n /**\r\n * Control the multiline modifier\r\n * @param {boolean} [enable=true] whether to enable this behaviour\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n searchOneLine(enable = true) {\r\n return enable ? this.removeModifier('m') : this.addModifier('m');\r\n }\r\n\r\n // Loops //\r\n\r\n /**\r\n * Repeat the previous item exactly n times or between n and m times\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n repeatPrevious(...quantity) {\r\n const isInteger = /\\d+/;\r\n const values = quantity.filter(argument => isInteger.test(argument));\r\n\r\n if (values.length === 0 || values.length > 2) {\r\n return this;\r\n }\r\n\r\n this.add(`{${values.join(',')}}`);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Repeat the previous at least once\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n oneOrMore() {\r\n return this.add('+');\r\n }\r\n\r\n /**\r\n * Match the value zero or more times\r\n * @param {string} value value to find\r\n * @param {integer} [lower] minimum number of times the value should be repeated\r\n * @param {integer} [upper] maximum number of times the value should be repeated\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n multiple(value, lower, upper) {\r\n if (value !== undefined) {\r\n value = VerbalExpression.sanitize(value);\r\n this.add(`(?:${value})`);\r\n }\r\n\r\n if (lower === undefined && upper === undefined) {\r\n this.add('*'); // Any number of times\r\n } else if (lower !== undefined && upper === undefined) {\r\n this.add(`{${lower},}`);\r\n } else if (lower !== undefined && upper !== undefined) {\r\n this.add(`{${lower},${upper}}`);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n // Capture groups //\r\n\r\n /**\r\n * Starts a capturing group\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n beginCapture() {\r\n // Add the end of the capture group to the suffixes temporarily so that compilation continues to work\r\n this._suffixes += ')';\r\n return this.add('(');\r\n }\r\n\r\n /**\r\n * Ends a capturing group\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n endCapture() {\r\n // Remove the last parenthesis from the _suffixes and add it to the regex\r\n this._suffixes = this._suffixes.slice(0, -1);\r\n return this.add(')');\r\n }\r\n\r\n // Miscellaneous //\r\n\r\n /**\r\n * Shorthand function for the string.replace function to allow for a more logical flow\r\n * @param {string} source string to search for\r\n * @param {string} value value to replace with\r\n * @returns {VerbalExpression} recompiled instance of VerbalExpression\r\n * @memberof VerbalExpression\r\n */\r\n replace(source, value) {\r\n source = source.toString();\r\n return source.replace(this, value);\r\n }\r\n\r\n /**\r\n * Convert to RegExp object\r\n * @returns {RegExp} equivalent RegExp instance\r\n * @memberof VerbalExpression\r\n */\r\n toRegExp() {\r\n const components = this.toString().match(/\\/(.*)\\/([gimuy]+)?/);\r\n const pattern = components[1];\r\n const flags = components[2];\r\n\r\n return new RegExp(pattern, flags);\r\n }\r\n}\r\n\r\n/**\r\n * Return a new instance of `VerbalExpression`\r\n * @export\r\n * @returns {VerbalExpression} new instance\r\n */\r\nfunction VerEx() { // eslint-disable-line no-unused-vars\r\n const instance = new VerbalExpression();\r\n instance.sanitize = VerbalExpression.sanitize;\r\n return instance;\r\n}\r\n"]} \ No newline at end of file diff --git a/dist/verbalexpressions.min.js.map b/dist/verbalexpressions.min.js.map index 03bc6deb..c32150ab 100644 --- a/dist/verbalexpressions.min.js.map +++ b/dist/verbalexpressions.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["JSVerbalExpressions/verbalexpressions.js"],"names":["root","factory","undefined","window","define","amd","module","exports","this","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","Constructor","protoProps","staticProps","prototype","_extendableBuiltin","cls","ExtendableBuiltin","instance","Reflect","construct","Array","from","arguments","setPrototypeOf","getPrototypeOf","create","constructor","value","__proto__","VerbalExpression","_extendableBuiltin2","TypeError","_classCallCheck","_this","self","call","ReferenceError","_possibleConstructorReturn","_prefixes","_source","_suffixes","_modifiers","subClass","superClass","_inherits","RegExp","pattern","compile","enable","add","sanitize","then","isArray","join","anyOf","lineBreak","modifier","includes","replace","addModifier","removeModifier","isInteger","_len","quantity","_key","values","filter","argument","test","lower","upper","slice","source","toString","components","match","flags"],"mappings":";;;;;;;CAAC,SAAUA,EAAMC,QACFC,IAATF,QAAiCE,IAAXC,SAAsBH,EAAOG,QACjC,mBAAXC,QAAyBA,OAAOC,IAEzCD,OAAO,WAAa,WAClB,OAAQJ,EAAY,MAAIC,MAEC,iBAAXK,QAAuBA,OAAOC,QAI9CD,OAAOC,QAAUN,IAEjBD,EAAY,MAAIC,IAbpB,CAeEO,KAAM,WAER,IAAIC,EAAe,WAAc,SAASC,EAAiBC,EAAQC,GAAS,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,IAAIE,EAAaH,EAAMC,GAAIE,EAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,UAAWF,IAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAAiB,OAAO,SAAUO,EAAaC,EAAYC,GAAiJ,OAA9HD,GAAYb,EAAiBY,EAAYG,UAAWF,GAAiBC,GAAad,EAAiBY,EAAaE,GAAqBF,GAA7gB,GAQnB,SAASI,EAAmBC,GACxB,SAASC,IACL,IAAIC,EAAWC,QAAQC,UAAUJ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I,IAAMoB,EAAQ,WACN/E,IAAV+E,QAAiC/E,IAAVgF,GAC9B1E,KAAKqD,IAAI,IAAMoB,EAAQ,IAAMC,EAAQ,KAGlC1E,QAYXa,IAAK,eACLkB,MAAO,WAGH,OADA/B,KAAK4C,WAAa,IACX5C,KAAKqD,IAAI,QAUpBxC,IAAK,aACLkB,MAAO,WAGH,OADA/B,KAAK4C,UAAY5C,KAAK4C,UAAU+B,MAAM,GAAI,GACnC3E,KAAKqD,IAAI,QAcpBxC,IAAK,UACLkB,MAAO,SAAiB6C,EAAQ7C,GAE5B,OADA6C,EAASA,EAAOC,YACFf,QAAQ9D,KAAM+B,MAUhClB,IAAK,WACLkB,MAAO,WACH,IAAI+C,EAAa9E,KAAK6E,WAAWE,MAAM,uBACnC7B,EAAU4B,EAAW,GACrBE,EAAQF,EAAW,GAEvB,OAAO,IAAI7B,OAAOC,EAAS8B,QAG/BnE,IAAK,WACLkB,MAAO,SAAkBA,GACrB,GAAIA,EAAM6C,OACN,OAAO7C,EAAM6C,OAGjB,GAAqB,iBAAV7C,EACP,OAAOA,EAWX,OAAOA,EAAM+B,QANE,0BAMgB,YAIhC7B,EA9kBY,GAgmBvB,OARA,WAEI,IAAIZ,EAAW,IAAIY,EAEnB,OADAZ,EAASiC,SAAWrB,EAAiBqB,SAC9BjC","file":"JSVerbalExpressions/verbalexpressions.min.js"} \ No newline at end of file +{"version":3,"sources":["JSVerbalExpressions\\verbalexpressions.js"],"names":["root","factory","undefined","window","define","amd","module","exports","this","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","Constructor","protoProps","staticProps","prototype","_extendableBuiltin","cls","ExtendableBuiltin","instance","Reflect","construct","Array","from","arguments","setPrototypeOf","getPrototypeOf","create","constructor","value","__proto__","VerbalExpression","_extendableBuiltin2","TypeError","_classCallCheck","_this","self","call","ReferenceError","_possibleConstructorReturn","_prefixes","_source","_suffixes","_modifiers","subClass","superClass","_inherits","RegExp","pattern","compile","enable","add","sanitize","then","isArray","join","anyOf","lineBreak","modifier","includes","replace","addModifier","removeModifier","isInteger","_len","quantity","_key","values","filter","argument","test","lower","upper","slice","source","toString","components","match","flags"],"mappings":";;;;;;;CAAC,SAAUA,EAAMC,QACFC,IAATF,QAAiCE,IAAXC,SAAsBH,EAAOG,QACjC,mBAAXC,QAAyBA,OAAOC,IAEzCD,OAAO,WAAa,WAClB,OAAQJ,EAAY,MAAIC,MAEC,iBAAXK,QAAuBA,OAAOC,QAI9CD,OAAOC,QAAUN,IAEjBD,EAAY,MAAIC,IAbpB,CAeEO,KAAM,WAER,IAAIC,EAAe,WAAc,SAASC,EAAiBC,EAAQC,GAAS,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,IAAIE,EAAaH,EAAMC,GAAIE,EAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,UAAWF,IAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAAiB,OAAO,SAAUO,EAAaC,EAAYC,GAAiJ,OAA9HD,GAAYb,EAAiBY,EAAYG,UAAWF,GAAiBC,GAAad,EAAiBY,EAAaE,GAAqBF,GAA7gB,GAQnB,SAASI,EAAmBC,GACxB,SAASC,IACL,IAAIC,EAAWC,QAAQC,UAAUJ,EAAKK,MAAMC,KAAKC,YAEjD,OADAf,OAAOgB,eAAeN,EAAUV,OAAOiB,eAAe5B,OAC/CqB,EAkBX,OAfAD,EAAkBH,UAAYN,OAAOkB,OAAOV,EAAIF,WAC5Ca,aACIC,MAAOZ,EACPX,YAAY,EACZE,UAAU,EACVD,cAAc,KAIlBE,OAAOgB,eACPhB,OAAOgB,eAAeP,EAAmBD,GAEzCC,EAAkBY,UAAYb,EAG3BC,EAiBX,IAAIa,EAAmB,SAAUC,GAS7B,SAASD,KAtDb,SAAyBZ,EAAUP,GAAe,KAAMO,aAAoBP,GAAgB,MAAM,IAAIqB,UAAU,qCAuDxGC,CA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,IAAK,WACLkB,MAAO,WACH,IAAI+C,EAAa9E,KAAK6E,WAAWE,MAAM,uBACnC7B,EAAU4B,EAAW,GACrBE,EAAQF,EAAW,GAEvB,OAAO,IAAI7B,OAAOC,EAAS8B,QAG/BnE,IAAK,WACLkB,MAAO,SAAkBA,GACrB,GAAIA,EAAM6C,OACN,OAAO7C,EAAM6C,OAGjB,GAAqB,iBAAV7C,EACP,OAAOA,EAWX,OAAOA,EAAM+B,QANE,0BAMgB,YAIhC7B,EA9kBY,GAgmBvB,OARA,WAEI,IAAIZ,EAAW,IAAIY,EAEnB,OADAZ,EAASiC,SAAWrB,EAAiBqB,SAC9BjC","file":"JSVerbalExpressions\\verbalexpressions.min.js"} \ No newline at end of file diff --git a/package.json b/package.json index 4e140534..5c33c40e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "verbal-expressions", "description": "JavaScript Regular expressions made easy", - "version": "0.3.0", + "version": "1.0.0", "keywords": [ "regular expressions", "regex"