Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Actually this pattern matches all passwords with at least 3 characters (a digit, an upper case and a lower case in any order) without a length limit (except for the regex engine). All characters must be word characters (ie: from the class <code>\w</code>).</p> <p>The author intention was probably to match all passwords between 6 and 20 word characters with at least one digit, one upper case and one lower case, as the quantifier and the lookaheads suggest.</p> <p>In short this pattern is wrong, but probably aims what this classical password validation pattern does:</p> <pre><code>^(?=\w*[A-Z])(?=\w*[a-z])(?=\w*\d)\w{6,20}$ </code></pre> <p>or this one without all redundant <code>\w</code>:</p> <pre><code>^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)\w{6,20}$ </code></pre> <p>Explanation: lookaheads are zero-width assertions, they don't consume characters, they are only tests. Consequence each of them are performed from the start of the string since they are anchored to the <code>^</code>. If each lookahead succeeds, then <code>\w{6,20}</code> is tested always from the start of the string to know if it contains only between 6 and 20 word characters. <code>$</code> means the end of the string.</p> <p>As said in comments, this pattern comes from the book <em>"Effortless E-commerce" first edition, by Larry Ullman</em>.</p> <p>Even if the author wrotes:</p> <blockquote> <p><em>"And, admittedly, even I often have to look up the proper syntax for patterns, but this one requires a high level of regular expression expertise."</em></p> </blockquote> <p>and even if I disagree with the second part of the sentence, I think this pattern is a simple typo. However I don't know if this one has been corrected in the second edition.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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