An implementation of a Regex parser in Java