Learning of regular expressions by pattern matching