As mobydickus said, it is difficult to decipher what that code you posted actually does. Would you be able to provide a SSCEE or at least the entire java code for that regex class?