Refactor SQL LIKE escaping, fix splitting regexp