Unescape before escape

Otherwise the echo statement would've been escaped before the unescaped preg match could complete