Reputation: 631
Only binary digits upto 8 digits
(preg_match("/^[0-1]{1,8}$/", $binary)
How to make a preg_match() that is upto 11 digits only that starts only with 09 and 63?
(preg_match('/^[!{09}|{63}]/', $mobile)
Problem is only 09 and 63 should start first, and do not exceed at 11 digits.
Upvotes: 0
Views: 154
Reputation: 3533
/^(09|63)[\d]{9}$/m
Tested with:
09999999999 => pass
63999999999 => pass
11999999999 => fail
63aaaaaaaaa => fail
09bbbbbbbbb => fail
Upvotes: 1
Reputation: 39443
This should work for you:
preg_match("/^(?:63|09)[0-1]{0,8}$/", $binary)
Upvotes: 0