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

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

Open
#3,297 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
25.5k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

[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 **\***).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the “Lookahead and lookbehind” article linked in the issue, especially its lookahead and lookbehind sections. Compare the documented examples with JavaScript’s restrictions on non-fixed-length patterns in lookbehind expressions. Done means the article clearly explains the limitation and distinguishes lookahead behavior from lookbehind behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.