Skip to content
masterclass Buddy

Jest · Module

stringMatching

expect.stringMatching checks whether a received string matches a string or regular expression. Use it inside Jest matchers such as toEqual, arrayContaining, or objectContaining for flexible matching.

Last updated

Syntax

expect.stringMatching(string | regexp)

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

Subscribe
  • expect.not.stringMatching
  • expect.arrayContaining
  • expect.objectContaining
  • toEqual
  • toHaveBeenCalledWith
  • toMatchObject

Source: Expect · Jest. Checked 2026-11-03.