我们可以在java中使用正则表达式检查多个模式吗? [英] can we check multiple patterns using regex in java?
本文介绍了我们可以在java中使用正则表达式检查多个模式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用正则表达式检查2个模式。
i want to check 2 patterns using regex.
我可以同时检查这两种模式(如if(condition1 | condition2)条件)。
can i check those both patterns in the same time (like if(condition1 | condition2) condition).
任何想法?
推荐答案
你可以完全按照你的方式去做,用管道分隔两个+表达式
You can do it exactly the way you did, with pipe separating the two+ expressions
例如:常规表达式(abc)|(def)
将匹配 abc
或 def
For instance: The regular expresion (abc)|(def)
would match abc
OR def
这篇关于我们可以在java中使用正则表达式检查多个模式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文