map_text_regex function

Map text to character table (allowing for matching patterns).