-
-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: difference between @stdlib/regexp/whitespace
and \s
?
#3107
Comments
👋 Hi there! 👋 And thank you for opening your first issue! We will get back to you shortly. 🏃 💨 |
@stdlib/regexp/whitespace
instead of \s
?@stdlib/regexp/whitespace
instead of \s
?
@xuhdev Thanks for raising this issue. The two are not equivalent. E.g., In [1]: var s = '\u0085'
Out[1]: '\x85'
In [2]: /\s/.test(s)
Out[2]: false
In [3]: reWhitespace.REGEXP.test(s)
Out[3]: true You are right that we should be more explicit in the documentation. We do implicitly document the difference in the source code:
Namely, ECMAScript does not consider the NEL unicode character to be whitespace, as demonstrated above; however, we consider the line terminator to be whitespace. |
@stdlib/regexp/whitespace
instead of \s
?@stdlib/regexp/whitespace
and \s
?
Can i work on this issue ? |
@yuvi-mittal Feel free to submit a PR. |
let me solve this issue |
I am already working on it .
|
@kgryte there is only one line difference between the two - @stdlib/regexp/whitespace considers the NEL Unicode character (\u0085) as whitespace, while ECMAScript's \s does not as simple as that i have to submit the PR request for this can u please tell which repo consist the source code of stlib.io/docs website? |
@yours7himanshu You should update the respective package README in this repository, as this repository contains all relevant source documentation. The website is simply the collection of package READMEs converted to HTML. |
Description
The doc of regex/whitespace says:
But \s does the same thing:
I think an explanation in the doc can be helpful. The git history of the library also doesn't shed any light on the reason. (Perhaps it was created at a time when JS was less powerful?)
Related Issues
No response
Questions
No response
Demo
No response
Reproduction
Expected Results
Actual Results
Version
No response
Environments
N/A
Browser Version
No response
Node.js / npm Version
No response
Platform
No response
Checklist
The text was updated successfully, but these errors were encountered: