You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// // Match a string consisting of numbers and lower case letters, and
/// // generate `"10a"`.$crate::patterns::
/// "id_string": term!("^[0-9a-z]$", "10a")
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:
^[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.
The text was updated successfully, but these errors were encountered:
mjpieters
added a commit
to mjpieters/pact-reference
that referenced
this issue
May 20, 2024
Correct the example regex used for the term! and matching_regex! docs,
and remove an accidental copy-pasta from the comment string in the
example.
Fixespact-foundation#424
This is the example given in the docstring for the
term!()
macro:pact-reference/rust/pact_consumer/src/patterns/special_rules.rs
Lines 377 to 379 in e44458a
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.
The text was updated successfully, but these errors were encountered: