Instead of using dot .
, use non spaces \S
:
^(?=(.*\d){3,})(?=(.*[A-Z]){2})(?=.*\W{1,})(?=(.*[a-z]){1,})\S{12,14}$
// here ___^^
And is this a typo match at least 4 digits - (?=(.*\d){3,})
,
it should be:
match at least 3 digits - (?=(.*\d){3,})
or
match at least 4 digits - (?=(.*\d){4,})
Same for other counts.