lib: better regexp escape