simplify the logging part, complexify the regex