Fix regression introduced by previous commit.
Move regex to their own functions.