How can we use more than two regular expressions in a String.split() method in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

20th Dec 2018, 1:28 PM
Nilesh Ingale
Nilesh Ingale - avatar
4 Answers
20th Dec 2018, 8:36 PM
Tashi N
Tashi N - avatar
+ 4
Thanks.
21st Dec 2018, 2:42 AM
Nilesh Ingale
Nilesh Ingale - avatar
+ 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
22nd Dec 2018, 1:45 PM
Pavel Zubakha
Pavel Zubakha - avatar
0
Hi
1st Jan 2019, 4:38 PM
طارق اشرف
طارق اشرف - avatar