需要动态正则表达式 [英] Need Dynamic regular expression
本文介绍了需要动态正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要动态正则表达式函数
对于Ex:我正在尝试输入
进行Google搜索
"Sachin Tendulkar"这是我的正则表达式@"\ b({0})\ w * \ b",它将匹配整个单词,如果Sachin Tendulkar可用则表示匹配,如果它匹配"Sachin"或"Tendulkar"则表示它将不匹配我需要正则表达式或函数
任何人都可以帮助我
问候,
Karthick
Hi ,
I need Dynamic regular expression function
For Ex : i am try google search in that i am typing
"Sachin Tendulkar" this my regex @"\b({0})\w*\b" it will match Whole word if Sachin Tendulkar avaliable means it will match if it "Sachin" or "Tendulkar" means it wont match i need regex or function
any one help me
Regards,
Karthick
推荐答案
希望以下代码能解决您的问题
Hi,
I hope the following code will solve your problem
string res = @"Sachin Tendulkar-Legend Of Indian Cricket Team";
Console.WriteLine(Regex.IsMatch(res,@"(Sachin|Tendulkar)"));
--SRJ
--SRJ
这篇关于需要动态正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文