V2EX  ›  英汉词典

Regex

释义 Definition

“regex” 是 “regular expression” 的缩写,指正则表达式:一种用来描述、匹配、查找、替换文本模式的符号语言,常用于编程与文本处理。(也可指“正则表达式引擎/语法”本身。)

发音 Pronunciation (IPA)

/ˈrɛdʒɛks/

例句 Examples

I used a regex to find all the email addresses in the file.
我用正则表达式在文件里找出所有电子邮箱地址。

To validate user input, the program applies a regex that allows letters, numbers, and underscores but rejects spaces and punctuation.
为验证用户输入,程序使用一个正则表达式:允许字母、数字和下划线,但拒绝空格和标点符号。

词源 Etymology

“regex” 来自 regular expression 的口语化缩写。“regular” 在这里有“规则化、可用规则描述”的含义;“expression” 指“表达式”。这一术语在计算机科学与形式语言领域普及后,逐渐被程序员简化为 “regex”。

相关词 Related Words

文学作品用例 Literary Works

  • Mastering Regular Expressions (Jeffrey E. F. Friedl)(经典技术书名中直接使用“Regular Expressions”,讨论 regex 的思想与实践)
  • Beautiful Code (edited by Andy Oram & Greg Wilson)(收录多篇与代码技巧相关的文章,常涉及包括正则在内的文本处理思路)
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   3580 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 07:32 · PVG 15:32 · LAX 23:32 · JFK 02:32
♥ Do have faith in what you're doing.