updated for regular expressions