Skip to content

[zh-cn] create translation of 'input boundary assertion'#35019

Merged
yin1999 merged 5 commits intomainfrom
input-boundary-assertion-zhcn
Apr 10, 2026
Merged

[zh-cn] create translation of 'input boundary assertion'#35019
yin1999 merged 5 commits intomainfrom
input-boundary-assertion-zhcn

Conversation

@jasonren0403
Copy link
Copy Markdown
Contributor

Description

Motivation

Additional details

Related issues and pull requests

part of #13254

@jasonren0403 jasonren0403 requested a review from a team as a code owner April 8, 2026 01:25
@jasonren0403 jasonren0403 requested review from irvin and removed request for a team April 8, 2026 01:25
@github-actions github-actions bot added the l10n-zh Issues related to Chinese content. label Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

@PassionPenguin PassionPenguin left a comment

Choose a reason for hiding this comment

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

另外一个文件的comments请忽略,我在 #35034 处理了:)

@@ -39,9 +39,7 @@ console.log(text.match(regexpFoxQuality));
<td><code>^</code></td>
<td>
<p>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

L6 which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions).

似乎前译者的翻译把两个部分混淆到一块了?

匹配输入的开头。如果多行模式设为 true,<code>^</code>
在换行符后也能立即匹配,比如 <code>/^A/</code> 匹配不了 "an A" 里面的
"A",但是可以匹配 "An A" 里面第一个 "A"。
<a href="/zh-CN/docs/Web/JavaScript/Reference/Regular_expressions/Input_boundary_assertion"><strong>起始输入边界断言</strong></a>:匹配输入的起始。如果启用了 <a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline"><code>multiline</code></a>(m)标志,则也会匹配换行符之后的字符。比如 <code>/^A/</code> 不匹配“an A”中的“A”,但是可以匹配“An A”中第一个“A”。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

btw,冒号是不是该被加粗?

<strong>Input boundary beginning assertion:</strong>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

后面完整翻译的时候再统一改吧,都可以的。个人感觉比较好的方式还是把冒号放外面。

<a href="/zh-CN/docs/Web/JavaScript/Reference/Regular_expressions/Input_boundary_assertion"><strong>终止输入边界断言</strong></a>:匹配输入的结束。如果启用了 <a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline"><code>multiline</code></a>(m)标志,则也会匹配换行符之后的字符。比如 <code>/t$/</code> 不匹配“eater”中的“t”,但是可以匹配“eat”中的“t”。
</p>
</td>
</tr>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

L84

          若要匹配退格字符 (<code>[\b]</code>),参见<a href="/zh-CN/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes">字符类</a>

格式问题

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

以及L69改成“示例”吧,和别的地方统一起来

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

image

匹配输入的开头。如果多行模式设为 true,<code>^</code>
在换行符后也能立即匹配,比如 <code>/^A/</code> 匹配不了 "an A" 里面的
"A",但是可以匹配 "An A" 里面第一个 "A"。
<a href="/zh-CN/docs/Web/JavaScript/Reference/Regular_expressions/Input_boundary_assertion"><strong>起始输入边界断言</strong></a>:匹配输入的起始。如果启用了 <a href="/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline"><code>multiline</code></a>(m)标志,则也会匹配换行符之后的字符。比如 <code>/^A/</code> 不匹配“an A”中的“A”,但是可以匹配“An A”中第一个“A”。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

后面完整翻译的时候再统一改吧,都可以的。个人感觉比较好的方式还是把冒号放外面。

Co-authored-by: Hoarfroster <hoarfroster@outlook.com>
Co-authored-by: A1lo <yin199909@aliyun.com>
@yin1999 yin1999 enabled auto-merge (squash) April 10, 2026 05:51
@yin1999 yin1999 merged commit ae63854 into main Apr 10, 2026
9 of 11 checks passed
@yin1999 yin1999 deleted the input-boundary-assertion-zhcn branch April 10, 2026 05:53
@github-project-automation github-project-automation bot moved this from Review requested to Done in MDN translated-content l10n-zh Apr 10, 2026

## 描述

`^` 断言当前位置是输入的开头,`$` 断言当前位置是输入的结尾。因为两者都是*断言*,它们不会消耗任何字符。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[mdn-linter] reported by reviewdog 🐶

Suggested change
`^` 断言当前位置是输入的开头,`$` 断言当前位置是输入的结尾。因为两者都是*断言*,它们不会消耗任何字符。
`^` 断言当前位置是输入的开头,`$` 断言当前位置是输入的结尾。因为两者都是*断言*,它们不会消耗任何字符。


`^` 断言当前位置是输入的开头,`$` 断言当前位置是输入的结尾。因为两者都是*断言*,它们不会消耗任何字符。

更准确地说,`^` 断言左侧的字符超出了字符串的范围;`$` 断言右侧的字符超出了字符串的范围。如果设置了 [`m`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline) 标志,则 `^` 也会匹配左侧字符是[行终止符](/zh-CN/docs/Web/JavaScript/Reference/Lexical_grammar#行终止符)的情况,`$` 同理也会匹配右侧字符是行结束符的情况。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[mdn-linter] reported by reviewdog 🐶

Suggested change
更准确地说,`^` 断言左侧的字符超出了字符串的范围;`$` 断言右侧的字符超出了字符串的范围。如果设置了 [`m`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline) 标志,则 `^` 也会匹配左侧字符是[行终止符](/zh-CN/docs/Web/JavaScript/Reference/Lexical_grammar#行终止符)的情况,`$` 同理也会匹配右侧字符是行结束符的情况。
更准确地说,`^` 断言左侧的字符超出了字符串的范围;`$` 断言右侧的字符超出了字符串的范围。如果设置了 [`m`](/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline) 标志,则 `^` 也会匹配左侧字符是[行终止符](/zh-CN/docs/Web/JavaScript/Reference/Lexical_grammar#行终止符)的情况,`$` 同理也会匹配右侧字符是行结束符的情况。

isValidIdentifier(" foo "); // false
```

该函数在进行代码生成(即使用代码生成代码)时非常有用,因为你可使用与其他字符串属性不同的合法标识符,如使用[点号表示法](/zh-CN/docs/Web/JavaScript/Reference/Operators/Property_accessors#点号表示法)代替[方括号表示法](/zh-CN/docs/Web/JavaScript/Reference/Operators/Property_accessors#方括号表示法):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[mdn-linter] reported by reviewdog 🐶

Suggested change
该函数在进行代码生成(即使用代码生成代码)时非常有用,因为你可使用与其他字符串属性不同的合法标识符,如使用[点号表示法](/zh-CN/docs/Web/JavaScript/Reference/Operators/Property_accessors#点号表示法)代替[方括号表示法](/zh-CN/docs/Web/JavaScript/Reference/Operators/Property_accessors#方括号表示法)
该函数在进行代码生成(即使用代码生成代码)时非常有用,因为你可使用与其他字符串属性不同的合法标识符,如使用[点号表示法](/zh-CN/docs/Web/JavaScript/Reference/Operators/Property_accessors#点号表示法)代替[方括号表示法](/zh-CN/docs/Web/JavaScript/Reference/Operators/Property_accessors#方括号表示法)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

l10n-zh Issues related to Chinese content.

Projects

Development

Successfully merging this pull request may close these issues.

3 participants