Can someone explain the meaning of these characters. I\'ve looked them up but I don\'t seem to get it.
The whole regular expression is:
/^.*(?=.{8,})(?=.
^.* //Start of string followed by zero or more of any character (except line break)
.*$ //Zero or more of any character (except line break) followed by end of string
So when you see this...
(?=.*[@#$%^&+=]).*$
It allows any character (except line break) to come between (?=.*[@#$%^&+=])
and the end of the string.
To show that .
doesn't match any character, try this:
/./.test('\n'); is false
To actually match any character you need something more like [\s\S]
.
/[\s\S]/.test('\n') is true