Skip to content

docs: difference between @stdlib/regexp/whitespace and \s? #3107

Open
@xuhdev

Description

@xuhdev

Description

The doc of regex/whitespace says:

Returns a regular expression to match a white space character.

But \s does the same thing:

Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to [\f\n\r\t\v\u0020\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]. For example, /\s\w*/ matches " bar" in "foo bar".

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

  • Read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationImprovements, additions, or changes to documentation.Help WantedExtra attention is needed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions