# assertStringMatches Source: https://smartassertions.dev/assertions/assertStringMatches/ Index of every page: https://smartassertions.dev/llms.txt Assert that a string matches a regular expression, with type narrowing. A regular expression carries no type-level shape, so this narrows an unknown value to a string and stops there. ## Usage ```ts import { assertStringMatches } from "@kensio/smartass"; const key: unknown = "2026/08/23/14/orders-1-2026-08-23-14-30-00-000"; assertStringMatches(key, /^\d{4}\/\d{2}\/\d{2}\/\d{2}\//); // key is now narrowed to a string ``` ## Source Source file: [`src/assert/string-matches/string-matches.assert.ts`](https://github.com/KensioSoftware/smartass/blob/main/src/assert/string-matches/string-matches.assert.ts)