1.Need 10 digit mobile No(working)
2.Can be start 0-9(working)
3.not more then 10 digit(not working->that required not working it's take also more than 10 digit like exp 11, 12 digit and more also )
for that i have implement that rule
'mobile_no' =>array(
'rule'=>array('custom','/([0-9]{1}[0-9]{9})/'),
'allowEmpty'=>false,
'message'=>'Invalid mobile number! mobile number format: eg 0755434434'
),
so i want to know where is problem in my code related to 3rd point
thanks in adv
The problem is that your regex says "match anything that contains a 10-digit phone number", however, what you really want is "match any string with 10 characters that is a phone number".
The following regex should fix the issue: /^([0-9]{1}[0-9]{9})$/
Your regex is not correct. Try:
([0]{1}[0-9]{9})(?=\W)