Var aa='1000-01-0000;
Var pattern=/\ d {3} - {2} - \ d \ d {4}/;
Alert (pattern. The test (aa));
CodePudding user response:
Seem to know the reason, to add ^ and $to var pattern=/^ \ d {3} - {2} - \ d \ d {4} $/like is no problem, also want to consult with me see this style, have a plenty of \ d {2, 3} want to consult this style said what does that meanCodePudding user response:
\ d {2, 3}//the number do 2, up to three Numbers, that is, matching two or three figures\ d {3}//is only matching three Numbers