The regex given in the example will only match a single lowercase letter or number, because it lacks a quantifier for the [0-9a-z] group. It should have a + quantifier, matching at least one digit or lower-case letter:
^[0-9a-z]+$
Without the + the example given won't match.
The comment text ends in $crate::patterns::, which looks like a copy-paste error to me; it is the prefix used in most of the macro definitions and doesn't fit in the comment text.
The same two issues apply to the matching_regex!() macro defined below this.
Side note: Could terms be automatically tested against the given example value? It'd be a good internal consistency check.
This is the example given in the docstring for the
term!()
macro:https://github.com/pact-foundation/pact-reference/blob/e44458a8616856d3726470dd8f3884340999bf1e/rust/pact_consumer/src/patterns/special_rules.rs#L377-L379
There are two issues here:
The regex given in the example will only match a single lowercase letter or number, because it lacks a quantifier for the
[0-9a-z]
group. It should have a+
quantifier, matching at least one digit or lower-case letter:Without the
+
the example given won't match.The comment text ends in
$crate::patterns::
, which looks like a copy-paste error to me; it is the prefix used in most of the macro definitions and doesn't fit in the comment text.The same two issues apply to the
matching_regex!()
macro defined below this.Side note: Could terms be automatically tested against the given example value? It'd be a good internal consistency check.