-2

I would wish a PHP regex in order to validate Greek mobile phone numbers. The number must contains 10 digits. The first two numbers must be 69xxxxxxxx

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Αρης
  • 45
  • 4

2 Answers2

0

GREEK Mobile Number Validation

You can preg_match() to validate 10-digit mobile numbers ^69 first two number should be start with 69:

//Example
$mobile_number = 6955555559;// Your number

//Checking phone number
if(preg_match('/^69[0-9]{8}+$/', $mobile_number)){
    echo "Correct number";
}else{
    echo "Wrong number";
}
Maths RkBala
  • 2,207
  • 3
  • 18
  • 21
0

//Following script is PHP Regex for Greek mobile phone with prefix 69 and to validate 10-digit numbers. This ^[6]{1}[9]{1} will check for particular 69 in front and this [0-9]{8}$ will check 8 numbers

$phone = "6988888888";
$validation = "/^[6]{1}[9]{1}[0-9]{8}$/";
preg_match($validation,$phone,$m);

echo $m[0];

// Output: 6988888888
Pawan Thakur
  • 591
  • 8
  • 19
  • Thank you for this code snippet, which may provide some immediate help. A proper explanation would [greatly improve](https://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) its educational value by showing why this is a good solution to the problem, and would make it more useful to future readers with similar, but not identical, questions. Please edit your answer to add explanation, and give an indication of what limitations and assumptions apply. – basvk Jul 14 '17 at 07:22