@openexam/regex
v0.1.0
Published
Regex-validated text-answer widget for OpenExam (spec 0.2).
Readme
@openexam/regex
Regex-validated text-answer widget. The author supplies a regex
pattern (anchored to ^…$ automatically) plus optional flags and
a placeholder; the student's text input is graded by matching
against the pattern.
What's a properly-capitalized first name?
::: response regex { pattern="[A-Z][a-z]+", placeholder="e.g. Maria" }
:::Pattern is matched anchored: ^(?:<pattern>)$. Authors who
want substring match write .*foo.*.
Allowed flags: i (case-insensitive), m (multiline),
s (dotall), u (unicode). g and y are forbidden — they
break .test() semantics for single-string matching.
Body must be empty in v1; the prompt prose lives before the directive in the assignment body.
License
Apache-2.0. See LICENSE and the canonical ../../LICENSE at the repository root.
