Consolidate RegEx matching routines in one class. Add a simple class for caching compiled RegEx patterns.
Remove duplicate code from classes extending Image.  Update them all to use the RegexUtil class.