tqmd1
01-20-2012, 05:15 PM
Dear experts
I have following codes
Var re=/(\d){4}-(\d){7}/;
When I test this string
0300-685706263
It says TRUE
But I validate this string exactly
0300-6857062
Please help
Amphiluke
01-20-2012, 05:30 PM
Not sure that understand you correctly. Maybe this will help:
var re=/^(\d){4}\-(\d){7}$/;
Philip M
01-20-2012, 05:48 PM
Dear experts
I have following codes
Var re=/(\d){4}-(\d){7}/;
When I test this string
0300-685706263
It says TRUE
But I validate this string exactly
0300-6857062
Please help
0300-685706263 returns true because it matches your pattern. What you want is to match your pattern and nothing but. As amphiluke has shown you.
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.