I\'m using this pattern to check the validation of a phone number
^[0-9\\-\\+]{9,15}$
It\'s works for 0771234567 and +0
0771234567
+0
/^(([+]{0,1}\d{2})|\d?)[\s-]?[0-9]{2}[\s-]?[0-9]{3}[\s-]?[0-9]{4}$/gm
https://regexr.com/4n3c4
Tested for
+94 77 531 2412 +94775312412 077 531 2412 0775312412 77 531 2412 // Not matching 77-53-12412 +94-77-53-12412 077 123 12345 77123 12345
+94 77 531 2412
+94775312412
077 531 2412
0775312412
77 531 2412
// Not matching
77-53-12412
+94-77-53-12412
077 123 12345
77123 12345