Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I can explain what the parts of the regex do, but in general I find this quite odd:</p> <pre><code>^.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$ </code></pre> <p>Basically what you said is true - there is no other magic in the regex.</p> <p><code>^.*</code> - match the beginning of the line and 0+ characters then ensure that</p> <p>The following just assert - none of them matches/captures anything. It's called the positive lookahead if you want to look it up. if all of them evaluate to true, the last part of the regex will do the rest:</p> <p><code>(?=.{10,})</code> - from where the first matching stops (could be after the beginning of the line) there is a string of 10+ chars (any chars)</p> <p><code>(?=.*\d)</code> - and there is at least one digit in the whole string ahead</p> <p><code>(?=.*[a-z])</code> - and a lower case letter</p> <p><code>(?=.*[A-Z])</code> - and an upper case letter</p> <p>If all that is true, then:</p> <p><code>.*$</code> - match everything till the end of the line</p> <p>Note: if any of the asserts fail, nothing will be matched.</p> <p><strong>To your edit</strong></p> <p>I don't think so - it's not the same to say that there is an upper and lower case letter and a digit somewhere in the string, and to say that the string consists of 10+ characters of which all are either digits or letters (upper or lower case) or both. Your regex would match a string that consists of only digits as well as only letters or a mix of both - the original regex ensures that each of these classes is represented at least once. It seems that someone might have used it to validate a user password or something like that.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload