Skip to content

test

String.test(target, source)

Tests if target string matches the source regular expression.

Example

ts
import { String } from "@monstermann/string";

String.test("hello world", /world/); // true
String.test("hello world", /\d+/); // false
ts
import { String } from "@monstermann/string";

pipe("hello world", String.test(/world/)); // true
pipe("hello world", String.test(/\d+/)); // false