summaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
authortylov <[email protected]>2023-07-10 12:16:44 +0200
committertylov <[email protected]>2023-07-10 12:16:44 +0200
commit8debe47bc014c41b6cf8082dcef4b87e4ef29cfa (patch)
tree9d2a770573930191d569c9a25e2e0e684b905a26 /misc
parent7342a721e5dbef94bb1b1541f01154fe4a37aeb8 (diff)
downloadSTC-modified-8debe47bc014c41b6cf8082dcef4b87e4ef29cfa.tar.gz
STC-modified-8debe47bc014c41b6cf8082dcef4b87e4ef29cfa.zip
Renamed input enum flags for cregex functions.
Diffstat (limited to 'misc')
-rw-r--r--misc/examples/regex_match.c2
-rw-r--r--misc/examples/regex_replace.c2
-rw-r--r--misc/tests/cregex_test.c12
3 files changed, 8 insertions, 8 deletions
diff --git a/misc/examples/regex_match.c b/misc/examples/regex_match.c
index ebda366f..310e0797 100644
--- a/misc/examples/regex_match.c
+++ b/misc/examples/regex_match.c
@@ -28,7 +28,7 @@ int main()
printf(" %g\n", (double)*i.ref);
// extracts the numbers only to a comma separated string.
- cstr nums = cregex_replace_sv(&re, csview_from(str), " $0,", 0, NULL, CREG_R_STRIP);
+ cstr nums = cregex_replace_sv(&re, csview_from(str), " $0,", 0, NULL, CREG_STRIP);
printf("\n%s\n", cstr_str(&nums));
cstr_drop(&nums);
diff --git a/misc/examples/regex_replace.c b/misc/examples/regex_replace.c
index 2c7794af..3a33efde 100644
--- a/misc/examples/regex_replace.c
+++ b/misc/examples/regex_replace.c
@@ -48,7 +48,7 @@ int main()
printf("euros: %s\n", cstr_str(&str));
/* Strip out everything but the matches */
- cstr_take(&str, cregex_replace_sv(&re, csview_from(input), "$3.$2.$1;", 0, NULL, CREG_R_STRIP));
+ cstr_take(&str, cregex_replace_sv(&re, csview_from(input), "$3.$2.$1;", 0, NULL, CREG_STRIP));
printf("strip: %s\n", cstr_str(&str));
/* Wrap all words in ${} */
diff --git a/misc/tests/cregex_test.c b/misc/tests/cregex_test.c
index 3ddcc608..4e192de6 100644
--- a/misc/tests/cregex_test.c
+++ b/misc/tests/cregex_test.c
@@ -15,7 +15,7 @@ CTEST(cregex, compile_match_char)
ASSERT_EQ(re.error, 0);
csview match;
- ASSERT_EQ(cregex_find(&re, inp="äsdf", &match, CREG_M_FULLMATCH), CREG_OK);
+ ASSERT_EQ(cregex_find(&re, inp="äsdf", &match, CREG_FULLMATCH), CREG_OK);
ASSERT_EQ(M_START(match), 0);
ASSERT_EQ(M_END(match), 5); // ä is two bytes wide
@@ -193,14 +193,14 @@ CTEST(cregex, search_all)
int res;
ASSERT_EQ(re.error, CREG_OK);
inp="ab,ab,ab";
- res = cregex_find(&re, inp, &m, CREG_M_NEXT);
+ res = cregex_find(&re, inp, &m, CREG_NEXT);
ASSERT_EQ(M_START(m), 0);
- res = cregex_find(&re, inp, &m, CREG_M_NEXT);
+ res = cregex_find(&re, inp, &m, CREG_NEXT);
ASSERT_EQ(res, CREG_OK);
ASSERT_EQ(M_START(m), 3);
- res = cregex_find(&re, inp, &m, CREG_M_NEXT);
+ res = cregex_find(&re, inp, &m, CREG_NEXT);
ASSERT_EQ(M_START(m), 6);
- res = cregex_find(&re, inp, &m, CREG_M_NEXT);
+ res = cregex_find(&re, inp, &m, CREG_NEXT);
ASSERT_NE(res, CREG_OK);
}
}
@@ -280,7 +280,7 @@ CTEST(cregex, replace)
ASSERT_STREQ(cstr_str(&str), "start date: 31.12.2015, end date: 28.02.2022");
// Strip out everything but the matches
- cstr_take(&str, cregex_replace_sv(&re, csview_from(input), "$3.$2.$1;", 0, NULL, CREG_R_STRIP));
+ cstr_take(&str, cregex_replace_sv(&re, csview_from(input), "$3.$2.$1;", 0, NULL, CREG_STRIP));
ASSERT_STREQ(cstr_str(&str), "31.12.2015;28.02.2022;");
}
}