commit f60803c62d926292ba26ada6b4cfc1071381d8b3
parent 895834613ce4f4de64f5c5790415c21a935805b8
Author: Vlad-Stefan Harbuz <vlad@vladh.net>
Date: Fri, 13 May 2022 16:41:23 +0100
regex: add test() example to README
Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/regex/README b/regex/README
@@ -20,6 +20,9 @@ the longest match among the leftmost matches.
const re = regex::compile(`[Hh]are`)!;
defer regex::regex_finish(&re);
+ const does_match = regex::test(&re, "Hello Hare, hello Hare.")!;
+ fmt::printfln("matched? {}", does_match)!;
+
const first_match = regex::find(&re, "Hello Hare, hello Hare.")!;
match (first_match) {
case void => void;