这是正确的简写 - “regex”或“正则表达式”

发布于 2024-09-05 19:51:38 字数 1432 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(13

妥活 2024-09-12 19:51:38
/regexp?/    

/regexp?/    

百思不得你姐 2024-09-12 19:51:38

Googlefightregex 获胜,685000 比 289000(大约为 2.37:1)。

另外,regexp大声说出来很奇怪,因为以“-ksp”声音结尾的单词很少(如果有的话?),但有很多以“-ecks”结尾的单词“ 声音。

Googlefight says regex wins, 685000 to 289000 (which is about 2.37:1).

Also, regexp is strange to say out loud because there are so few (if any?) words that end in a "-ksp" sound, but there are plenty of words that end in a "-ecks" sound.

弥繁 2024-09-12 19:51:38

他们都很好。 “regex”更常见,但“regexp”的使用范围比此处其他答案所示的更广泛。一些例子:

They are both OK. "regex" is more common, but "regexp" has been used more widely than the other answers here indicate. Some examples:

冷默言语 2024-09-12 19:51:38

regex 更短;因此,更好:)而且,它更容易发音。

regex is shorter; therefore, better :) Also, it is easier to pronounce.

避讳 2024-09-12 19:51:38

公认的简写是“regex”。

根据我的经验,“Regexp”仅在 Javascript 上下文中使用,其中表示正则表达式的对象实际上称为 RegExp

The accepted shorthand is "regex".

"Regexp" is only used, in my experience, in the context of Javascript where the object representing a regular expression is actually called RegExp.

话少心凉 2024-09-12 19:51:38

我认为“regex”更常见(例如,Java 包 java.util.regex)。如果 10,000 名猫王粉丝不会错的话,那么我会根据人数投票支持这一点。

I think "regex" is more common (e.g., Java package java.util.regex). If 10,000 Elvis fans can't be wrong, then I'd vote for that on the strength of numbers.

梦中的蝴蝶 2024-09-12 19:51:38

根据维基百科

在计算中,正则表达式,
也称为正则表达式或正则表达式,
...

According to Wikipedia

In computing, regular expressions,
also referred to as regex or regexp,
...

风柔一江水 2024-09-12 19:51:38

“正则表达式”更常见,在 Perl FAQ 中使用。 Google 为“regex”提供了 450 万次点击,为“regexp”提供了 360 万次点击。维基百科两者都使用。

你更喜欢什么?如果你交替使用它们,我不认为任何人都会对你产生不好的看法。

"regex" is more common and what is used in the Perl FAQ. Google gives 4.5 million hits for "regex" and 3.6 million for "regexp." Wikipedia uses both.

What do you prefer? I don't think anyone will think of you badly if you use them interchangeably.

⊕婉儿 2024-09-12 19:51:38

我认为是时候停止用速记或缩写来思考了。我们在日常任务中使用的正则表达式与计算机科学或形式语言理论的正则表达式完全不同。这就是为什么 Larry Wall 和 Perl 社区的其他杰出成员多年来更喜欢“正则表达式”:称它们为 RegExp 或 RegEx,甚至 RE,表明一种不再适用的关系。

I think it's time to quit thinking in terms of shorthands or abbreviations. The regexes that we use in our daily tasks are a different breed entirely from the regular expressions of computer science or formal language theory. This is why Larry Wall and other prominent members of the Perl community have preferred "regex" for years: to call them RegExp or RegEx, or even RE, suggests a relationship that no longer applies.

还在原地等你 2024-09-12 19:51:38

我会说它是“正则表达式”,这是基于我自己的经验、我所听到的以及这里的社区讨论。

我现在找不到它,但这个讨论是关于 SO 上的元标签,这就是为什么这是 唯一标记的问题“regexp”,其余的(8441 和计数)被标记为 “regex”


这里只是一个侧面的想法:“正确”是否重要?想一想这里的目的,为什么要用这个词?进行沟通。在某种程度上,什么正确与否并不重要,重要的是哪一个可以有效地与更多人沟通。我想说,如果大多数受众都使用错误的术语,那么您可以很容易地争论使用错误的术语,因为沟通是您的目标。

I would say it's "regex", this is based on my own experience, how I've heard it, and the community discussion here.

I can't find it at the moment, but this discussion was on meta over tags on SO, which is why this is the only question tagged "regexp", the rest (8441 and counting) are tagged "regex".


Just a side thought here: does it matter which is "correct?" Think about the purpose here, why do you use any word? To communicate. To a certain degree, it doesn't matter what's correct or not, it matters which one you can effectively communicate to more people. I would say you could easily argue to use an incorrect term, if that's what the majority of your audience uses, since communication is your goal.

ゞ记忆︶ㄣ 2024-09-12 19:51:38

两者都适合书面讨论,尽管您可能不想太频繁地大声说出“regexp”;)

对于在代码中使用,我认为 regexp 可能更清晰。特别是如果您使用大写字母,例如 RegEx/RegExp。 Ex 后缀通常用于指示更简单函数的扩展版本...即 Windows API 中的 CreateWindow/CreateWindowEx,因此就代码的可读性而言,RegExp 可能不太模糊。

Both are fine for written discourse, though you probably don't want to say "regexp" out loud too often ;)

For use in code, I think regexp is probably clearer. Especially if you use capitalization such as RegEx/RegExp. An Ex suffix is often used to indicate an extended version of a simpler function... i.e. CreateWindow/CreateWindowEx in the Windows API, so RegExp might be a little less ambiguous as far as readability of code goes.

请别遗忘我 2024-09-12 19:51:38

我还听说/读过:

reg-exp

有些人更喜欢regex,因为复数regexes“更好”! (除了其他答案解释的原因之外)。

.NET regex : System.Text.RegularExpressions.Regex

JavaScript regexp : RegExp

I have also heard/read:

reg-exp

And some people prefer regex because the plural regexes is "nicer"! (in addition to reasons explained by other answers).

.NET regex : System.Text.RegularExpressions.Regex

JavaScript regexp : RegExp

堇年纸鸢 2024-09-12 19:51:38

我更喜欢“re”,但这取决于语言。 JavaScript 将其列为“RegExp”,而大多数其他语言仅将其称为“RegEx”。

谷歌搜索时,选择较短的版本。但在论坛中,请使用“re”;)

I prefer "re", but it depends on the language. JavaScript lists it as "RegExp", whereas most other languages just call it "RegEx."

When googling, go with the shorter version. But in forums, use "re" ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文