+ 5
How can we use more than two regular expressions in a String.split() method in Java?
If my string contains both whitespace as well as tabs then how to write a string.split() method to split the string with both of the regular expressions?
4 ответов
+ 17
Have a look at the POSIX character classes:
https://docs.oracle.com/javase/9/docs/api/java/util/regex/Pattern.html
An example with Punct:
https://code.sololearn.com/c7bHiQgDC4zd/?ref=app
+ 4
Thanks.
+ 1
You can use either syntax for regular expression. For example:
a | b
Matches either a or b.
Also see example how i have implemented password validation:
https://code.sololearn.com/ci5m428JvUf9/?ref=app
more info at https://www.tutorialspoint.com/java/java_regular_expressions.htm
0
Hi