Pattern p1 = Pattern.compile(".................");
Pattern p2 = Pattern.compile("xxxxxxxxxxxxxxxxxxx");
Since both p1 and p2 are quite long, and it's hard to write a single pattern to cover all cases in p1 and p2. Is it possible to write another pattern p3 that is built upon on p1 and p2, so that I can only run one Matcher:
Matcher m = p3.matcher(str);
You can use this to combine patterns:
Pattern pattern = Pattern.compile(".................|xxxxxxxxxxxxxxxxxxx");
to match either one:
Matcher matcher = pattern.matcher(s);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With