Skip to main content

matching_regex

Macro matching_regex 

Source
macro_rules! matching_regex {
    ($regex:expr, $example:expr) => { ... };
}
Expand description

A pattern which matches the regular expression $regex (specified as a string) literal, and which generates $example.

use pact_consumer::*;

json_pattern!({
  // Match a string consisting of numbers and lower case letters, and
  // generate `"10a"`
  "id_string": matching_regex!("^[0-9a-z]+$", "10a")
});