Add function in Regex.java