Minor code refactoring to the changes in RegexValidator