javascript-tutorial / javascript-tutorial/en.javascript.info

Lack of essential detail about regexp lookbehind syntax in "Lookahead and lookbehind" article

Aperta
#3,297 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
HTML
Stelle
25.5k
Fork
4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

[Part 3 (Additional articles)](https://javascript.info/#tab-3)
[Chapter 7 (Regular expressions)](https://javascript.info/regular-expressions)
[Article 14 (Lookahead and lookbehind)](https://javascript.info/regexp-lookahead-lookbehind)

Why you don't mention that in JS non fixed length regexps (including quantifiers, backreferences etc.) are not allowed inside lookbehind expression ?

First you talk about [lookahead](https://javascript.info/regexp-lookahead-lookbehind#lookahead), and using regexp with quantifier as lookahead condition in your example.

_Copied from [www.javascript.info](https://javascript.info)_
For example, `\d+(?=\s)`**`(?=.*30)`** looks for `\d+` that is followed by a space `(?=\s)`, and there’s `30` somewhere after it **`(?=.\*30)`**

Right after this you briefly talk about [lookbehind](https://javascript.info/regexp-lookahead-lookbehind#lookbehind) and say it is the same thing but looks behind, without mentioning that it actually cannot do the same thing with non fixed lenght regular expressions (including quantifiers like **\***).

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia con l’articolo “Lookahead and lookbehind” collegato nell’issue, prestando particolare attenzione alle sezioni su lookahead e lookbehind. Confronta gli esempi documentati con le restrizioni di JavaScript sui pattern di lunghezza non fissa nelle espressioni lookbehind. Il lavoro è completato quando l’articolo spiega chiaramente la limitazione e distingue il comportamento di lookahead da quello di lookbehind.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
1/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.