becke-ch--regex--s0-0-v1--base--pl--lib
Advanced tools
Comparing version 1.1.1 to 1.2.0
{ | ||
"name": "becke-ch--regex--s0-0-v1--base--pl--lib", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "A JavaScript Regular Expression library, extending the standard RegExp class with missing functionality", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -24,4 +24,5 @@ ## Synopsis | ||
var regex = new Regex(CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN, 'g'); | ||
var result = str.replace(regex,CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN_REPLACE_STRING); | ||
var result = regex[Symbol.replace](str, CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN_REPLACE_STRING); | ||
//Alternative Syntax: For browsers supporting "Symbol": Chrome & Firefox | ||
var resultAlternative = str.replace(regex,CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN_REPLACE_STRING); | ||
console.log(result === "3 spaces:'&nbsp;&nbsp; ' followed by a tab:'&emsp;' followed by an ampersand:'&amp;' followed by less-than sign:'&lt;' followed by greater-than sign:'&gt;' followed by newline:'<br>' and that's it"); | ||
@@ -166,3 +167,4 @@ | ||
str.replace(new Regex(pattern, flags), replacementStringArray); | ||
//str.replace(new Regex(pattern, flags), replacementStringArray); | ||
(new Regex(pattern, flags))[Symbol.replace](str, replacementStringArray); | ||
} | ||
@@ -169,0 +171,0 @@ } |
@@ -14,2 +14,6 @@ /* | ||
//Fixes issue for browsers (IE, Safari - respective in general WebKit based browsers e.g. JavaFX) not supporting | ||
// JavaScript "Symbol" | ||
Symbol = (typeof Symbol === "undefined") ? [] : Symbol; | ||
/** | ||
@@ -273,3 +277,4 @@ * This class is an extension of the standard {@linkcode RegExp} class adding missing functionality. | ||
* <code> | ||
* Syntax: <b>string.replace(new Regex(pattern), [array of replacement strings])</b><br> | ||
* Syntax: <b>(new Regex(pattern))[Symbol.replace](string, [array of replacement strings])</b><br> | ||
* Alternative Syntax: For browsers supporting "Symbol": Chrome & Firefox: string.replace(new Regex(pattern), [array of replacement strings])<br> | ||
* Example:<br> | ||
@@ -280,3 +285,5 @@ * //Convert plain text to html: Replace special characters (multiple spaces, tabs, ...) in plain text with their html "equivalent":<br> | ||
* var regex = new Regex(CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN, 'g');<br> | ||
* var result = myPlainText.replace(regex,CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN_REPLACE_STRING); | ||
* var result = regex[Symbol.replace](myPlainText,CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN_REPLACE_STRING);<br> | ||
* //Alternative Syntax: For browsers supporting "Symbol": Chrome & Firefox<br> | ||
* var resultAlternative = myPlainText.replace(regex,CONVERT_TEXT_SPECIAL_CHARACTER_TO_HTML_ESCAPE_CHARACTER_PATTERN_REPLACE_STRING); | ||
* </code> | ||
@@ -283,0 +290,0 @@ * <br> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46788
5
743
191