[#80334782] use \A and \z instead of ^ and $

Pretty complicated stuff.
-- DT ASB