JSFiddle - React, Tailwind, and code Playground

JavaScript

var pw = '123456789'
var sixCharsRegEx = /^.{6,7}/

alert(pw.search(sixCharsRegEx))