Refactor Regexp logic (more readable?)