Replaced the ugly testRegex sub with another ugly one