🔍 Moduł regex

use "regex";

Funkcje

FunkcjaOpis
regexMatch(str, pattern)Dopasuj → {value, index, groups} lub null
matchAll(str, pattern)Wszystkie dopasowania
testRegex(str, pattern)Czy pasuje? (true/false)
replaceRegex(str, pattern, repl)Zamień wszystkie
replaceFirst(str, pattern, repl)Zamień pierwsze
splitRegex(str, pattern)Podziel po wzorcu
escapeRegex(str)Escape znaków specjalnych

Przykłady

use "regex"; // Test let isEmail = testRegex("a@b.com", ".+@.+\\..+"); print(isEmail); // true // Replace let cleaned = replaceRegex("hello123world", "\\d+", ""); print(cleaned); // "helloworld" // Match all let numbers = matchAll("a1b2c3", "\\d"); print(numbers); // [{value: "1"}, {value: "2"}, ...]