Adding validation to the regular expressions. Improved performance and log information.