Valid with newline

Changed \Z to \z anchor and added some test assertions. Not valid with newline in some formats