Import std.text.regex
String
extend
Extend String
Regular expressions on a String: whether one matches, and replacing and splitting by one.
-
Whether
patternmatches somewhere in it, as Regex(pattern).IsMatch does. Its compiledpatternis kept for a while, so calling it again with the same one doesn't compile it again. -
@PanicsAtCaller Public Method ReplaceAll(pattern: String, replacement: String): String Throws RegexErrormethod #A copy with each match of
patternreplaced byreplacement, as Regex(pattern).Replace does. -
The parts between each match of
pattern, as Regex(pattern).Split gives them.Examples
Expect((Try "a1b22c".SplitBy(r"\d+")) == ["a", "b", "c"]) Expect(Try "hello".Matches(r"^h.*o$"))
Report an issue with this page or with FutureBlitz on GitHub.