refactored for the use of the Regex typedef