gosh this regex makes me sad (it being inline)

Can we abstract this to a named function?