Assertion.match

Asserts for a string wrapped around the Assertion to match a regular expression.

  1. auto match(RegEx re, string file, size_t line)
    struct Assertion(T)
    @safe
    static if(isSomeString!T)
    match
    (
    RegEx
    )
    (
    RegEx re
    ,
    string file = __FILE__
    ,
    size_t line = __LINE__
    )
    if (
    isSomeString!T &&
    isRegexFor!(RegEx, T)
    )
  2. auto match(U re, string file, size_t line)

Examples

"something weird".should.match(`[a-z]+`);
"something weird".should.match(regex(`[a-z]+`));
"something 2 weird".should.not.match(ctRegex!(`^[a-z]+$`));
"1234numbers".should.match(`[0-9]+[a-z]+`);
"1234numbers".should.not.match(`^[a-z]+`);

Meta