Positive/Negative Lookaheads

Continuing the discussion from freeCodeCamp Challenge Guide: Positive and Negative Lookahead:

In the answer code:

Shouldn’t we use \w{6,} instead of \w{6} so that it accepts passwords with even 7 characters?

However both codes seem to be working. I didn’t understand why.

if you would be using anchors (^ and/or $) that would be something, but as they are not there, the test method will return true as long as there is a matching substring (there is nothing imposing that the whole string have to match the pattern)