regex: Use static regexs where possible

Rather than declaring and compiling a constant regex every time a chunk
of code is executed, build the regex once.
regex: Search on strings where possible
cmTarget: Remove an unused variable
Merge topic 'dev/static-regex' into next

1b003c1f cmTarget: Remove an unused variable
7492a7b8 regex: Search on strings where possible
3e7194a2 regex: Use static regexs where possible