A regular expression (RegEx) is a pattern language for matching text. In answer extraction, it searches generated responses for common answer patterns after free-form generation. section 1.1.1
Regex can make variable model outputs easier to evaluate, but it is brittle: a numeric pattern may capture an intermediate calculation instead of the final answer. section 1.1.1
Extracting a numerical answer
A response may contain “= 1,680 - 84 = 1,596” or explanatory text such as “The answer is 1,596.” A regex intended to extract numbers can select the wrong occurrence. section 1.1.1
Prefer structured outputs or constrained decoding when reliable extraction matters; these approaches reduce dependence on post-processing free-form text. section 1.1.1































