LPS-41084 When possible, create regex pattern once and reuse instead of ...

...creating multiple times