(PUP-2663) Adjust regexp to only match complete string, and not \n

\s includes newline when ^$ is used.
^$ skips leading and trailing optional matches
\A\z does not skip as they force matching of strings start/end