Forum archive 2000-2006

Michael Gage - must_have_filter

Michael Gage - must_have_filter

by Arnold Pizer -
Number of replies: 0
inactiveTopicmust_have_filter topic started 8/15/2004; 4:44:12 PM
last post 8/15/2004; 4:44:12 PM
userMichael Gage - must_have_filter  blueArrow
8/15/2004; 4:44:12 PM (reads: 1231, responses: 0)


Filter for checking that an answer has (or doesn't have) a certain string in it. This can be used to screen answers where you want them in a particular form (e.g., if you allow most functions, but not trig functions in the answer, or if the answer must include some string).


must_have_filter(str, yes_no, error_msg)


First argument is the string to have, or not have
Second argument is optional, and tells us whether yes or no
Third argument is the error message to produce (if any).


a filter ( a subroutine suitable for use in answer evaluators)


$new_eval->install_pre_filter(must_have_filter("sin", 'no', "can't use sin() in this answer));

Macro Definition File


<| Post or View Comments |>