Remember
(?!....)
is a lookaround, so it matches 0 characters. So ^(?!....)$
will only match an empty string! (Think about it). Try ^(?!....$)
instead (the $ anchor inside the lookaround)