if there is no pattern just assign "*" so later you don't have to check for `pattern` being empty