I have some regex that tests against if the string has at least 6 characters. Though I also want it to be true if there is just an empty string also.
Regex:
let regexToTestName = /^[a-zA-Z0-9.!@#$%^&*()_-]{6,}$/g;
let usedName = ''; //or let usedName = 'atLeast6Char';
let isNameMatch = regexToTestName.test(usedName);
As you can see it will work for characters specified of at least 6 in length. But how do I also get a true value if it is an empty string?