# stringMatching Source: https://smartassertions.dev/matchers/stringMatching/ Index of every page: https://smartassertions.dev/llms.txt Matcher for a string matching a regular expression. Matchers are applied through assertObjectMatches, where they narrow the corresponding property type. A regular expression carries no type-level shape, so the property is narrowed to a string and no further. ## Usage ```ts import { assertObjectMatches, stringMatching } from "@kensio/smartass"; const value: unknown = { key: "2026/08/23/14/orders-1-2026-08-23-14-30-00-000", }; assertObjectMatches(value, { key: stringMatching(/^\d{4}\/\d{2}\/\d{2}\//), }); // value is now narrowed to an object with a string key // { // key: string; // } ``` ## Source Source file: [`src/assert/string-matches/string-matches.match.ts`](https://github.com/KensioSoftware/smartass/blob/main/src/assert/string-matches/string-matches.match.ts)