Grader: output-matches
Taxonomy
Section titled “Taxonomy”| Property | Value |
|---|---|
| Determinism | static |
| Cost | free |
| Portability | t1-universal |
| Reference | reference-free |
| Temporal scope | trajectory-level |
| Score kind | code |
Config
Section titled “Config”graders: - type: output-matches config: pattern: "function\\s+\\w+\\("| Field | Type | Required | Description |
|---|---|---|---|
pattern | string | Yes | Regular expression pattern to match against output |
negate | boolean | No | When true, passes when the pattern does NOT match |
Negated variant
Section titled “Negated variant”Use output-not-matches as a shorthand for negate: true:
graders: - type: output-not-matches config: pattern: "(?i)error|exception"This is equivalent to type: output-matches with negate: true.
Behavior
Section titled “Behavior”Constructs a RegExp from the pattern and tests it against trajectory.output.
Inline flags: Use the (?flags) prefix syntax to set regex flags:
(?i)pattern— case-insensitive matching(?m)pattern— multiline (^/$match line start/end)(?s)pattern— dotAll (.matches newlines)(?ims)pattern— combine multiple flags
graders: - type: output-matches config: pattern: "(?i)function\\s+\\w+\\(" # case-insensitivePasses when the pattern matches (or does NOT match if negated). Fails otherwise.
Evidence examples
Section titled “Evidence examples”✔ Output matches pattern /function\s+\w+\(/✘ Output does not match pattern /function\s+\w+\(/