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

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

未关闭
#3,297 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
HTML
星标
25.5k
派生
4k
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 issue 中链接的“Lookahead and lookbehind”文章开始,尤其阅读其中关于 lookahead 和 lookbehind 的部分。将文档中的示例与 JavaScript 对 lookbehind 表达式中非固定长度模式的限制进行比较。完成的标准是文章清楚地解释这一限制,并区分 lookahead 的行为与 lookbehind 的行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
documentation
Issue 类型
文档
难度
1/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。