var subject = "Parametre - Bloc Notes"
var match = Regex.Match(subject, "(?i)(?:blah|para|foo).*?");
// This will work
//"Para" doesn't match "Param" and it is before the dash
var subject = "Parametre - Bloc Notes"
var match = Regex.Match(subject, "(?i)(?:blah|blo|foo).*?");
// This will not work
// "Blo" match "Bloc" and it is after the dash
我认为“-”是我误解的主要原因。
编辑:
我真的很抱歉,所以我希望正则表达式在破折号之前匹配 Param,我该怎么做?
编辑2:
我承认我的问题真的很模棱两可,所以我的目标是在任何字符串中找到参数词。