An "answer" that is provided to a fillin should **not** be a regular expression. This is used separately for static representations as the text that IS the correct answer. It will only be the provided answer that is escaped when used with @use-answer. [The guide is incorrect in implying that @use-answer="yes" avoid using regular expressions. This is what needs to be fixed.] The checker for an answer CAN be a regular expression, but it needs to be separately provided in the <evaluation> block.
Andrew gave a good example that if the correct answer is "foo()", then the checker sees the parentheses as an empty character grouping and would *not* match "foo()" as submitted text, but would match "foo". Or suppose the answer is a literal string "2+5", then regular expressions see that as any of the following: 25, 225, 2225, 22225, etc, but would not match the literal submission "2+5".
I do want to add an attribute on <strcmp>, say @literal="yes", that also treats the submitted comparison text as a literal string instead of a regular expression and would escape that text as well. For example,
<fillin mode="string" name="my_blank" answer="foo()"/>
would be paired with
<evaluate name="my_blank">
<test correct="yes">
<strcmp use-answer="yes"/> <!-- escape the text -->
</test>
<test>
<strcmp literal="yes">foo[]</strcmp>
<feedback>Functions don't use square brackets.</feedback>
</test>
</evaluate>
And I just saw Andrew's response as well.
I would not be changing the Runestone Component behavior itself, so this is only going to affect new books authored with PreTeXt.
- Brian