thread: extract a common regexp pattern as a fixed variable