diff --git a/lib/node_modules/@stdlib/regexp/whitespace/README.md b/lib/node_modules/@stdlib/regexp/whitespace/README.md index 6ee0e1afc4af..6468dfa597b5 100644 --- a/lib/node_modules/@stdlib/regexp/whitespace/README.md +++ b/lib/node_modules/@stdlib/regexp/whitespace/README.md @@ -111,6 +111,26 @@ var out = replace( str, reWhitespace.REGEXP_CAPTURE, '$1$1' ); - Matches one related white space character without the Unicode character property "WSpace=Y" (zero width non-breaking space which was deprecated as of Unicode 3.2). +- Unlike the \s shorthand in JavaScript, @stdlib/regexp/whitespace explicitly targets Unicode 9.0 white space characters, ensuring consistency and compatibility across environments. + The predefined \s shorthand relies on the ECMAScript specification and may vary slightly in behavior, especially in older or less compliant environments. + Example demostrating difference + ```javascript + var testString = 'Hello\u200BWorld'; + + var regex = /\s/; + console.log(regex.test(testString)); // returns true in some engines(ES5 or older) + + var reWhitespace = require( '@stdlib/regexp/whitespace' ); + var RE_WHITESPACE = reWhitespace(); + console.log(RE_WHITESPACE.test(testString)); // returns false + + var arr = testString.split(regex); + console.log(arr); // ["Hello", "World"] + + arr = testString.split(RE_WHITESPACE); + console.log(arr); // ["Hello\u200BWorld"] + ``` + - The `REGEXP` regular expression is defined as ```text