开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜