[英]Match the either middle of a word or the entire word in regex
我想都匹配proposition
和sit
在字的中间。 我该如何使用正则表达式呢?
我知道您可以执行类似^(proposition|sit)$
但是我想知道是否还有其他方法。
这是允许的字符串(不视为多行条目):
proposition
sit
这将是一些不允许的字符串,这些字符串也不被视为多行条目:
Proposition
position
SIT
stuffit_archive.sit
proposition 65
我正在10.11.6 El Capitan下的bash 3.2.57(1)-release中使用if语句。
试试这个^.*(proposition|sit).*$
。 另外,请确保将调用此正则表达式的命令设置为不区分大小写。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.