stdlib-js / stdlib-js/stdlib

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

Abierto
#3,107 8 comentarios 0 reacciones 0 asignados Ver en GitHub
Documentation Help Wanted
Lenguaje dominante
JavaScript
Estrellas
6k
Forks
1.3k
Merge medio
1 d 3 h
PR fusionados (30 d)
611

Descripción

### Description

The [doc of regex/whitespace](https://stdlib.io/docs/api/latest/@stdlib/regexp/whitespace) says:

> Returns a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) to match a [white space](https://en.wikipedia.org/wiki/Whitespace_character) character.

But [\s does the same thing](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes):

> 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

```shell

```

### Expected Results

```shell

```

### Actual Results

```shell

```

### Version

_No response_

### Environments

N/A

### Browser Version

_No response_

### Node.js / npm Version

_No response_

### Platform

_No response_

### Checklist

- [x] Read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [x] Searched for existing issues and pull requests.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.