Split off the regex error printing into a function in a header. This may come in handy in a lot
of other areas.