Create regularexp2.java

Checks whether the regular expression is valid or not