开发者

C# regex to match text string

开发者 https://www.devze.com 2022-12-17 23:27 出处:网络
I am trying to use a regex to find text inside a 开发者_高级运维string. For example, have this 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消