jquery - RegEx never matches in a form tag pattern -


practicing making , using forms jquery class. given following part of assignment:

    password must follow pattern:     - first character must letter     - following characters may letters, numbers, , underscore     - must between 3 , 15 total characters password , confirm password entries must match  may use html5 input types , attributes. following regular      expression can used password: /^[a-za-z]\w{3,14}$/   

and so, within page put password tag (inside form tags) so:

<input type="text" id="password" pattern="/^[a-za-z]\w{3,14}$/" required> 

yet no password meets listed criteria passes. every time hit submit gives me pop-up saying "please match format requested". did wrong? i've been reading on regex , looks okay me (granted regex has never been strong point me)

remove both regex literal delimiters , start , end marks in pattern attribute:

<input type="text" id="password" pattern="[a-za-z]\w{2,14}" required> 

(i changed 3 2 because total numbers of characters supposed between 3 , 15)

from the mdn :

pattern

a regular expression control's value checked against. the pattern must match entire value, not subset. use title attribute describe pattern user. attribute applies when value of type attribute text, search, tel, url or email; otherwise ignored. regular expression language same javascript's. the pattern not surrounded forward slashes.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -