小编Ege*_*tes的帖子

正则表达式在coldfusion中匹配整个单词串

我试着这个例子

第一个例子

keyword = "star"; 
myString = "The dog sniffed at the star fish and growled";
regEx = "\b"& keyword &"\b"; 
if (reFindNoCase(regEx, myString)) { 
     writeOutput("found it"); 
} else { 
     writeOutput("did not find it"); 
} 
Run Code Online (Sandbox Code Playgroud)

示例输出 - >找到它

第二个例子

keyword = "star"; 
myString = "The dog sniffed at the .star fish and growled";
regEx = "\b"& keyword &"\b"; 
if (reFindNoCase(regEx, myString)) { 
     writeOutput("found it"); 
} else { 
     writeOutput("did not find it"); 
}
Run Code Online (Sandbox Code Playgroud)

输出 - >找到它

但我想找到整个单词.标点问题对我来说如何使用正则表达式进行第二个示例输出:没找到它

regex coldfusion

4
推荐指数
1
解决办法
847
查看次数

标签 统计

coldfusion ×1

regex ×1