Skip to content
masterclass Buddy

Jest · Matcher

toMatch

Jest's toMatch matcher checks whether a string matches a regular expression or contains supplied text. Add .not to require that it does not match.

Last updated

Syntax

expect(value).toMatch(regexp | string)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • expect
  • not
  • toBe
  • toEqual
  • toMatchObject
  • stringMatching

Source: Using Matchers · Jest. Checked 2026-11-03.