Check out example codes for "phone number regex java". It will help you in understanding the concepts better.

Code Example 1

String Afghanistan      = "+93 30 539-0605";         String Australia        = "+61 2 1255-3456";         String China            = "+86 (20) 1255-3456";         String Germany          = "+49 351 125-3456";         String India            = "+91 9876543210";         String Indonesia        = "+62 21 6539-0605";         String Iran             = "+98 (515) 539-0605";         String Italy            = "+39 06 5398-0605";         String NewZealand       = "+64 3 539-0605";         String Philippines      = "+63 35 539-0605";         String Singapore        = "+65 6396 0605";         String Thailand         = "+66 2 123 4567";         String UK               = "+44 141 222-3344";         String USA              = "+1 (212) 555-3456";         String Vietnam          = "+84 35 539-0605";

Code Example 2

String allCountryRegex = "^(\\+\\d{1,3}( )?)?((\\(\\d{1,3}\\))|\\d{1,3})[- .]?\\d{3,4}[- .]?\\d{4}$";

Learn ReactJs, React Native from akashmittal.com