有一个变量定义如下:
my $variable = "This is related to NSQ outage, it is being handled along with all other NSQ alarms. Network team is working on it.";
一些关键字是:"is nsq this server"
.
当有两个或多个关键字时,我可以有一个正则表达式$variable
,它可以返回 true 吗?
例子:
- 当关键字是“是 nsq 服务器”时:true
- 当关键字为“nsq machine server”时:false
谢谢,我想上面的问题已经解决了。
我还有一个问题如下:
my $var="this is related to NSQ outage, and this is";
$var=~/((this|sth).*){2,}/, return true.
实际上没有'sth' $var
,并且this
有两个。
在这种情况下如何使正则表达式返回 false?