I'm using an online regex checker such as regex101 to check my regex which is to be used by javascript such as (working but cut down regex for example only)
state = /^[a-zA-Z0-9]$/.test($(control).val())
My Regex is
(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9].{5,19}
Which when cut down into chunks should hopefully mean...
(?=.*[A-Z]) - Must include an Upper case char
(?=.*[0-9]) - Must include a numeric
[a-zA-Z0-9. ] - Can include any lower or upper case char, or Numeric, a period or space
. - Matching previous
{5,19} - the string must be 6-20 characters in length
This however still allows special characters such as !.
I've not used \d for decimals as I believe [0-9] should be more strict in this regard, and removed the period and space to see whether this was the cause, to no avail.
Where have I gone wrong to be allowing special characters?