Function human_regex::digit

source ·
pub fn digit() -> HumanRegex
Expand description

A function for the digit character class (i.e., the digits 0 through 9)

use human_regex::{beginning, end, one_or_more, digit};
let regex_string = beginning() + one_or_more(digit()) + end();
assert!(regex_string.to_regex().is_match("010101010100100100100101"));
assert!(!regex_string.to_regex().is_match("a string that is not composed of digits will fail"));