C# regex to match text string
I am trying to use a regex to find text inside a 开发者_高级运维string. For example, have this string:
one,two,three,four
If I want to see if it has one OR two, I can use "one|two". How do I create a regex for determining whether the string has one AND two?
^(?=.*\bone\b)(?=.*\btwo\b)
= two lookahead assertions that match if both "one" and "two" are present in the string.
精彩评论