Quality: Fixed lint ( function in loop )
Extracted regex construction from loop into a module var