I am trying to build my regex to validate phone numbers. These are the rules:
- Telephones should not contain any characters except
numbersand+ - Other strings which doesn't start with
06or+316or0316or00316are invalid.
This is what I tried:
$telephone = preg_replace('/[^0-9+]/','', $telephone);
removes all characters except + and numbers . Here still I need to check if the + is the first character or not. For example 466116+ or 21323+3122 are invalid.
preg_match('/^(06|+316)/i', $telephone) . I am trying here to add the starting conditions , but it doesn't work . Could you please help me out? I am lost with regex :| Thank you