I have the next regular expression:
(?=.*\d)(?=.*[A-Z]).*$
1) Contains one digit.
2) Contains UPPER case letters.
Example:
"asaZ1h" -> Correct
"asaZaksa" -> Incorrect
My question is what's the meaning of "?=" in this expression ?
I have the next regular expression:
(?=.*\d)(?=.*[A-Z]).*$
1) Contains one digit.
2) Contains UPPER case letters.
Example:
"asaZ1h" -> Correct
"asaZaksa" -> Incorrect
My question is what's the meaning of "?=" in this expression ?
The meaning of "?=" signifies a lookahead. This means that it'll assert that in a particular string a condition is true, but it won't consume any characters, thus the match that follows will start at the cursor position before the lookaheads. Good if you want to start matching one thing conditionally on another expression.
This might help.