Simul efun: simplify_string - simplify a string for better parsing Synopsis: string simplify_string(string arg) Description: This simulated efun changes a string so that the only characters to appear in the result are a-z, 0-9 and ' ' (space). This is done by first lower_case()ing the argument and then dividing it into "words", that means parts of it that do only consist of a-z and 0-9. Between two words and at the beginning and the end of the string a space ( ) will be added. Now you can simply parse the result with match(): The pattern can only consist of the characters mentioned above (and the asterisk * as a special matching character). Use patterns like this: "* *" You can of course match for lots of different patterns. Return value: the simplified string (as described above) Example: catch_tell(str) { string who; if (sscanf(str, "%s says: %s\n", who, str) != 2 && sscanf(str, "%s asks: %s\n", who, str) != 2) return; str = simplify_string(str); if (match("* froot loops *", str) || match("* froot loop *")) { if (match("* please *")) give_loops(); else say(query_name()+ " asks: Couldn't you be a bit more polite?\n"); } } Note: It would be better to delay the reaction via heart_beat() or call_out(), but that is another thing! See also: efun/match, efun/lower_case, efun/set_heart_beat, object/heart_beat, efun/call_out