implemented java regex Pattern cache

implemented java regex Pattern cache, since it is really cost intensive to create a pattern for every message

Pattern.matches()
"If a pattern is to be used multiple times, compiling it once and reusing it will be more efficient than invoking this method each time"