Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

即将到来的正则表达式新特性 #1883

Merged
merged 3 commits into from
Jul 14, 2017
Merged

即将到来的正则表达式新特性 #1883

merged 3 commits into from
Jul 14, 2017

Conversation

sunui
Copy link
Contributor

@sunui sunui commented Jul 12, 2017

@sqrthree 翻译完成

Issue: #1874

@atuooo
Copy link
Contributor

atuooo commented Jul 12, 2017

@sqrthree 校对认领

@linhe0x0
Copy link
Member

@atuooo 好的呢 🍺

@Tina92
Copy link

Tina92 commented Jul 12, 2017

@sqrthree 校对认领

@linhe0x0
Copy link
Member

@Tina92 妥妥哒 🍻

Copy link
Contributor

@atuooo atuooo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sunui 校对完啦


ES2015 introduced many new features to the JavaScript language, including significant improvements to the regular expression syntax with the Unicode (`/u`) and sticky (`/y`) flags. But development has not stopped since then. In tight collaboration with other members at TC39 (the ECMAScript standards body), the V8 team has proposed and co-designed several new features to make regular expressions even more powerful.
ES2015 JavaScript 语言引入了许多新特性,其中包括正则表达式语法的一些重大改进,新增了 Unicode `/u`) 和粘滞位 (`/y`)两个修饰符。但从那以后,发展从未止步。经过与 TC39ECMAScript 标准委员会)的其他成员的紧密合作,V8 团队提议并共同设计了让正则表达式更强大的几个新特性。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但从那以后,发展从未止步。

给人感觉像“在那之前,发展一直在止步”,建议改成 ”而在那之后,发展也并未停止“


These features are currently being proposed for inclusion in the JavaScript specification. Even though the proposals have not been fully accepted, they are already at [Stage 3 in the TC39 process](https://tc39.github.io/process-document/). We have implemented these features behind a flag (see below) in order to be able to provide timely design and implementation feedback to the respective proposal authors before the specification is finalized.
这些新特性目前已经计划包含在 JavaScript 标准中。即使提案还没有完全通过,它们已经进入 [TC39 流程的候选阶段](https://tc39.github.io/process-document/)了。我们已经在一个 flag(见下文)之后实现了这些功能,以便在最终定稿之前提供及时的设计和实现反馈给各自的提案作者。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

即使提案还没有完全通过,它们已经进入...

虽然...但是...

我们已经在一个 flag(见下文)之后实现了这些功能

我们已经在实现(更新?)完 flag (直接翻译成”修饰符“?)相关功能之后实现了这些特性

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 flag 不是修饰符,是指浏览器的实验功能



Named captures are an upcoming feature that helps mitigate these issues by allowing developers to assign names to captures. The syntax is similar to Perl, Java, .Net, and Ruby:
命名捕获是一个即将到来的特性,它允许开发者给捕获组分配名称来帮助缓解这些问题。语法类似于 PerlJava.Net Ruby
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

缓解这些问题

感觉怪怪的,要不译成 ”尽可能地解决这些问题“ ?


The name already describes its meaning pretty well. It offers a way to restrict a pattern to only match if preceded by the pattern in the lookbehind group. It comes in both matching and non-matching flavors:
名称已经很好地描述了它的意义。它提供一个方式来限制一个正则,只有后行组匹配通过之后才继续匹配。它提供匹配和非匹配两种选择:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

名称已经很好地描述了它的意义

根据上下文补全:” “后行断言”这个名字已经很好地描述了它的涵义“

Copy link

@Tina92 Tina92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sqrthree 校对完成,译者翻译的特别好~👍


ES2015 introduced many new features to the JavaScript language, including significant improvements to the regular expression syntax with the Unicode (`/u`) and sticky (`/y`) flags. But development has not stopped since then. In tight collaboration with other members at TC39 (the ECMAScript standards body), the V8 team has proposed and co-designed several new features to make regular expressions even more powerful.
ES2015 JavaScript 语言引入了许多新特性,其中包括正则表达式语法的一些重大改进,新增了 Unicode `/u`) 和粘滞位 (`/y`)两个修饰符。但从那以后,发展从未止步。经过与 TC39ECMAScript 标准委员会)的其他成员的紧密合作,V8 团队提议并共同设计了让正则表达式更强大的几个新特性。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unicode => Unicode 编码


This blog post gives you a preview of this exciting future. If you'd like to follow along with the upcoming examples, enable experimental JavaScript features at `chrome://flags/#enable-javascript-harmony`.
本文给您预览一下这个令人兴奋的未来。如果您愿意跟着体验这些即将到来的示例,可以在 `chrome://flags/#enable-javascript-harmony` 开启实验性 JavaScript 功能。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 可以在 chrome://flags/#enable-javascript-harmony

  • 可以在 chrome://flags/#enable-javascript-harmony 页面中


/^\p{Math}+$/u.test('∛∞∉'); // true
/^\p{Script_Extensions=Hiragana}+$/u.test('ひらがな'); // true


The full list of supported Unicode property classes can be found in the current [specification proposal](https://tc39.github.io/proposal-regexp-unicode-property-escapes/#sec-static-semantics-unicodematchproperty-p). For more examples, take a look at [this informative article](https://mathiasbynens.be/notes/es-unicode-property-escapes).
全部受支持的 Unicode 属性类列表可以在最新的[规范提案](https://tc39.github.io/proposal-regexp-unicode-property-escapes/#sec-static-semantics-unicodematchproperty-p)中找到。更多示例请查看[这篇内容丰富的文章](https://mathiasbynens.be/notes/es-unicode-property-escapes)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在最新的 => 在目前的

@sunui
Copy link
Contributor Author

sunui commented Jul 13, 2017

@sqrthree 修改完成

@linhe0x0 linhe0x0 merged commit b7696c5 into xitu:master Jul 14, 2017
@linhe0x0
Copy link
Member

已经 merge 啦~ 快快麻溜发布到掘金专栏然后给我发下链接,方便及时添加积分哟。

@sunui sunui deleted the translate branch July 14, 2017 05:43
RichardLeeH pushed a commit to RichardLeeH/gold-miner that referenced this pull request Jul 19, 2017
…slate

# By 根号三 (30) and others
# Via 根号三
* 'master' of https://github.com/xitu/gold-miner: (52 commits)
  ✨ Create how-to-implement-expandable-menu-on-ios-like-in-airbnb.md
  ✨ Create the-future-of-deep-learning.md
  ✨ Create the-limitations-of-deep-learning.md
  ✨ Create deep-learning-3-more-on-cnns-handling-overfitting.md
  ✨ Create deep-learning-2-convolutional-neural-networks.md
  ✨ Create deep-learning-1-setting-up-aws-image-recognition.md
  ✨ Create user-breakpoints-in-xcode.md
  ✨ Create reflections-on-eslints-success.md
  ✨ Create next-generation-3d-graphics-on-the-web.md
  Update react-redux-optimization.md
  语句,消息和归约器 (xitu#1882)
  理解 Python 中的异步编程 (xitu#1875)
  如何处理机器学习中的不平衡类别 (xitu#1870)
  Redux 并不慢,只是你使用姿势不对 —— 一份优化指南 (xitu#1897)
  修改一个拼写错误
  即将到来的正则表达式新特性 (xitu#1883)
  🚀 添加文章『 将 Kotlin 应用于现有 Java 代码的策略』到文章列表
  🚀 添加文章『是的,ES2017 (ES8)来了』到文章列表
  Update es8-was-released-and-here-are-its-main-new-features.md
  ✨ Create pyqt-versus-wxpython.md
  ...
cdadar pushed a commit to cdadar/gold-miner that referenced this pull request Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants