regular expression validation not working
-
Hello I am using CF7 Phone Module 2.0 with wp 3.5.
I have used this Telephone field in CF7 Generator, the fields ‘Regular expression to trigger changing to the alternative mask’ and ‘Regular expression to change back to the original mask’ are not very clear to me what to put here, but I think its for the custom regular expression validation pattern for the phone input.
I have to make a phone (mobile no.) field for Indian User, 10 digit mobile number starting first digit with 9,8 or 7 only.I have used the regex /^[789]\d{9}$/i in my php code and its working fine 100%. (helped with link: http://stackoverflow.com/questions/3813195/regular-expression-for-indian-mobile-numbers)
Example code for php (which I used in wordpress for some other custom form):
if(!preg_match(“/^[789]\d{9}$/i”, $mobileno))
{ $errMessage = ‘Mobile no. is invalid ‘.$mobileno;
$err = true;
}But when I put the same regex in cf7 phone field generator, the code is like
[phone* custphone mask:(999)999-9999 reDo:/^[789]\d{9}$/i reUndo:/^[789]\d{9}$/i]But the problem is, on saving the form, it displays the phone field wrong, breaking the regex from ‘\’ and displaying the regex string below the phone field. And validation not working.
—
Is this plugin able to parse the regex with forward slash ‘\’?
What I have to write in which field of generator to get my required validation working on this field?—
Please let me know.http://wordpress.org/extend/plugins/contact-form-7-phone-mask-module/
- The topic ‘regular expression validation not working’ is closed to new replies.