Modified listen function to accept a string, an array or a regular expression as the mapping argument and to return the matched results if it is a regular expression