定期的印象联合 [英] Regular epressions union
本文介绍了定期的印象联合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好。是否有可能在C#中使用正则表达式联合(从两个其他表达式中表达,以匹配这两个部分中的任何一个)?看起来这个功能存在于Ruby上( Regexp.union(/ dogs /,/ cats / i)#=> /(? - mix:dogs)|(?i-mx:cats)/
)但我在C#中找不到类似的东西。我会感谢你的帮助。
Hi. Is it possible to make regular expressions union in C# (make expression from two other expressions that will match any of that two parts)? Looks like this feature exist on Ruby (Regexp.union(/dogs/, /cats/i) #=> /(?-mix:dogs)|(?i-mx:cats)/
) but I can't find something similiar in C#. I would be thankful for help.
推荐答案
您好,
管道有相同的功能:|
常规表达 ^(狗|猫)
Hi,
There is the same features with the pipe: |
The regular expression ^(dogs|cats)
匹配单词:dogs 或 cats
matches words: dogs or cats
这篇关于定期的印象联合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文