-3

I try to make some regex solution to my phone number input validation but I have a problem.

Bulgarian numbers start like this

Mobile 7 digits after operator code

+359891231212
+359881231212
+359871231212
0891231212
0871231212
0881231212

Local 6 digits after operator code

+35952123123
052123123
051123123
054121212

So I search in Slackoverflow and find this answer but this is only covers mobile phone number https://stackoverflow.com/a/59623571/3228833

I'm not good in regex but I try my best and according to what I found on StackOverflow I change it like this

^(\+359|0)\s?[58](\d{2}\s\d{3}\d{3}|[234789]\d{6,7})$

But not working perfectly how I can make if regex start with for example 5 match with this if starts with 8 match is there any kind of solution for this

I don't understand why this question editors mark in duplicated I clearly said also I check this answers but not fixed my problem because of that I asking here if some mods reading this please to check before close my question what I'm asking

ZgrKARALAR
  • 483
  • 8
  • 28

0 Answers0