Wondering if there would be a better way where I do not have to create separate Pattern and Matcher objects the way I have it now.
The
string class has some convenience methods for regex. Under the covers, it still does create the pattern and matcher objects, but it will make your code shorter -- for example, the string class has a matches() method that will take a regex.
Henry