Separate regex from method