问题描述
大家好,
请帮我找到正则表达式:
我的价值如下:''Martin Lucas''
和我的输入字符串是:''我的名字是Martin Lucas,我和ABC先生一起工作'。
现在我必须匹配是否名称''Martin Lucas''存在于给定的字符串中。
请建议正则表达式
之前我正在使用
@(^ | \ s)+ mentioned_profilename + @(\ s | $)
这是我的正则表达式..它工作正常。但不能匹配值以''结束',''
例如,如果以下是我的字符串
你好@Nagsdada KumarDada,@ Vishal Shimpi和@Hatim Jawad
这个@Nagsdada KumarDada没有得到匹配
Hi all,
Please help me to find regex:
I have value like: ''Martin Lucas''
and my input string is : ''My name is Martin Lucas, i am working with Mr ABC''.
now i have to match whether the name ''Martin Lucas'' is exist in given string.
please suggest the regular expression
previously i was using
@"(^|\s)" + mentioned_profilename + @"(\s|$)"
this in my regex.. it was working fine. but can not match the value ends with '',''
eg if following is my string
hello @Nagsdada KumarDada, @Vishal Shimpi and @Hatim Jawad
in this @Nagsdada KumarDada was not getting match
这篇关于正则表达式匹配字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!