Functions: use strlenutf8 and a better match pattern