use constants for failure status, and extract regex logic