我是regex的新手,以下是我的问题:
下面的是文件的内容:
cts-pdr/comment-primary/:not spamming
cts-pdr/comment-primary/:please remove since not spamming
cts-pdr/comment-primary/:not spamming
cts-pdr/comment-primary/:not spamming
cts-pdr/comment-primary/:Not spamming
cts-pdr/comment-primary/:not spamming
cts-pdr/comment-primary/:please unblock since not spaming我在这里试图实现的是匹配冒号的第二部分。我想捕捉整个字符串,即:
(please\s.*)? [N|n]ot .*我无法得到正确的匹配。有人能帮忙吗?
发布于 2017-12-27 14:27:17
您可以做的是将正则表达式更新为:
mabye使用非捕获组(?:,类似于:
与please、Not或not匹配,后面跟着任何字符0或更多次.*。
https://stackoverflow.com/questions/47993764
复制相似问题