Docs (4.0.0)
class NegatedAssertion method

toMatchRegExp

Asserts that the value is a string that doesn’t match given regular expression.

toMatchRegExp(re: RegExp): void

Note
The assertion still fails if the value is not a string. Use the Assertion.asString() method to convert the value first if needed.

Example

// this succeeds:
let s = "foo";
expect(s).not.toMatchRegExp(/a/);

// this fails:
let n = 123;
expect(n).not.toMatchRegExp(/a/);

Related