正则表达式 Regular Expression

1 英语原意

正则表达式 Regular Expression(Regex)

2 英文解释含义

A regular expression (regex) is a sequence of characters that define a search pattern.

正则表达式 Regular Expression

Examples:

To match a sequence of literal characters, simply write those characters in the pattern.

To match a single character from a set of possibilities, use square brackets, e.g. [0123456789] matches any digit.

To match zero or more occurrences of the preceding expression, use the star (*) symbol.

To match one or more occurrences of the preceding expression, use the plus (+) symbol.

It is important to note that regex can be complex and difficult to read, so it is recommended to use tools like regex testers to debug and optimize your patterns.

A regular expression (sometimes called a rational expression) is a sequence of characters that define a search pattern, mainly for use in pattern matching with strings, or string matching, i.e. “find and replace” like operations. Regular expressions are a generalized way to match patterns with sequences of characters. It is used in every programming language like C++, Java and Python.

Example:  Regular expression for an email address :

^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$

The above regular expression can be used for checking if a given set of characters is an email address or not. 

3 Regular和Expression单词解释

3.1 Regular 

regular adjective (OFTEN)

happening or doing something often

频繁的;经常发生的;经常做的

  • a regular customer/churchgoer/reader/user
  • 老顾客/经常去教堂做礼拜的人/固定读者/老用户
  • Professional athletes make regular appearances on TV.
  • 职业足球运动员经常在电视上亮相。

regular adjective (EVEN)

existing or happening repeatedly in a fixed pattern, with equal or similar amounts of space or time between one and the next; even

定时的;固定的;有规律的;规则的;均匀的

  • Her heartbeat was regular.
  • 她的心跳很正常。
  • The gardeners planted the trees at regular intervals.
  • 园丁按照固定的间隔种树。
  • I suggest that we have regular meetings/meet on a regular basis.
  • 我建议我们定期会面。
  • Someone who is regular empties their bowels often enough, and a woman who is regular always has her period at approximately the same time.
  • (人)大便正常的;(女性)月经正常的
  • The doctor asked if I was regular/if my bowel movements were regular.
  • 医生问我大便是否正常。

regular adjective (USUAL)

usual or ordinary

普通的;一般的;寻常的

  • Her regular secretary was off sick for a week.
  • 她平时的秘书生病了,休假一周。
  • I couldn't see my regular dentist.
  • 我不能去找平时给我看病的那个牙医了。
  • You can use low-fat or regular cream cheese.
  • 你可以用低脂或普通的奶油奶酪。
  • Do you want large fries or regular fries with that?
  • 你想配大包还是普通薯条?

A regular verb, noun, or adjective follows the usual rules in the structure of its various forms.

(动词、名词或形容词)规则的,按规则变化的

  • "Talk" is a regular verb but "be" is not.
  • 动词 talk 是个规则动词,而 be 就不是。

a regular guy US

a normal man who is liked and trusted

可亲近信赖的人;好人

regular army, soldier, etc.

an army that exists all the time, or a soldier in such an army

正规军/正规军士兵等

regular adjective (SIMILAR)

the same on both or all sides

均匀的;端正的;整齐的

  • He's very handsome, with regular features and deep brown eyes.
  • 他相貌英俊,五官端正,长着一双深褐色的眼睛。
  • A square is a regular quadrilateral.
  • 广场是个正四边形。

regular adjective (COMPLETE)

real; complete

完全的;彻底的;十足的

  • The situation here now is becoming a regular disaster.
  • 这里的局势现在正在演变成一场惨重的灾难。
  • old-fashioned That child is a regular charmer/little nuisance.
  • 那个小孩真是个地地道道的迷人精/讨厌鬼。

regular noun [C] (CUSTOMER)

someone who often goes to a particular event or place, such as a shop or restaurant

常客,老顾客,老主顾

  • He's one of the regulars at the pub.
  • 他是酒馆的常客之一。

regular noun [C] (SOLDIER)

a soldier whose permanent job is being a soldier

职业军人,正规军人

3.2 expression

noun (NUMBERS)

in mathematics, a symbol or group of symbols that represent an amount

(数学中的)式,表达式

4xy² is an expression.

4xy²是一个表达式。

4 中文解释含义

正则表达式是一种用于匹配和操作文本的强大工具,它是由一系列字符和特殊字符组成的模式,用于描述要匹配的文本模式。

正则表达式可以在文本中查找、替换、提取和验证特定的模式。

5心得体会

Regular应该是有规律的、有规则的、按规则变化的意思,翻译成“正则”,让人不知所云。Regular Expression准确的翻译应该是有规则的表达式。

参考文献:

  • https://www.geeksforgeeks.org/write-regular-expressions/
  • https://www.runoob.com/regexp/regexp-syntax.html

写评论

  • 链接: 选填
  • 昵称: 必填
  • 验证码: vaeo