javascript - JS Regular Expression - global number of char -


i regular expression determinate string allows: -at least 2 digit; -at least 1 capital letter -at least 1 of char: !,$,?

my principal problem chars can situated in position!

ex: 1dfa2! it's ok 11aw!

practically, occurrence has global.

edit: tried, step step, first number, problem position!

/(0-9){2}/g 

i'm @ start regex

you can use following lookahead assertion:

^(?=.*\d.*\d)(?=.*[a-z])(?=.*[!$?]).*$ 

see demo


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -

html - href attribute breaking an element -