If the regex is empty, it should still return "^$", so that it will match an empty string.