I have the following regular expression:
passw = re.compile(r'^(?=.*\d)(?=.*[A-Z])(?=.*[\$|\?\!])[A-Za-z\d$!&]{8}$')
which I can interpret as string of length 8, which must contain at least one number, one big letter and one of characters($?!). And also consists only of numbers, letters and $?!.
?= - this symbol is known as lookahead assertion: For example, Isaac (?=Asimov)
will match 'Isaac '
only if itβs followed by 'Asimov'.
But how can we interpret .*
sign? What does it mean in regex?
Can we avoid it in this situation?