How to implement Regex Grader?