Move regexp outside of function

Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>