summaryrefslogtreecommitdiffhomepage
path: root/docs/cregex_api.md
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-13 18:03:22 +0100
committerTyge Løvset <[email protected]>2023-02-13 18:03:22 +0100
commita3645620cf4b8855801d9ca0cf7385de5a70c5d9 (patch)
tree4ef27f9dc36d03507d86a4e6fee66494152c76dd /docs/cregex_api.md
parent3421d7b745310da05117fa97348a99a4a6ef8b5b (diff)
downloadSTC-modified-a3645620cf4b8855801d9ca0cf7385de5a70c5d9.tar.gz
STC-modified-a3645620cf4b8855801d9ca0cf7385de5a70c5d9.zip
Removed support for uppercase version of c_sv() (i.e c_SV => c_sv).
Renamed c_ARGSV => c_SV. Old name is still working.
Diffstat (limited to 'docs/cregex_api.md')
-rw-r--r--docs/cregex_api.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/cregex_api.md b/docs/cregex_api.md
index 8cabb6fc..64fb6a2b 100644
--- a/docs/cregex_api.md
+++ b/docs/cregex_api.md
@@ -108,7 +108,7 @@ int main() {
// Lets find the first date in the string:
csview match[4]; // full-match, year, month, date.
if (cregex_find(&re, input, match, CREG_DEFAULT) == CREG_OK)
- printf("Found date: %.*s\n", c_SVARG(match[0]));
+ printf("Found date: %.*s\n", c_SV(match[0]));
else
printf("Could not find any date\n");
@@ -124,7 +124,7 @@ int main() {
For a single match you may use the all-in-one function:
```c
if (cregex_find_pattern(pattern, input, match, CREG_DEFAULT))
- printf("Found date: %.*s\n", c_SVARG(match[0]));
+ printf("Found date: %.*s\n", c_SV(match[0]));
```
To compile, use: `gcc first_match.c src/cregex.c src/utf8code.c`.
@@ -137,13 +137,13 @@ To iterate multiple matches in an input string, you may use
csview match[5] = {0};
while (cregex_find(&re, input, match, CREG_M_NEXT) == CREG_OK)
c_forrange (k, cregex_captures(&re))
- printf("submatch %lld: %.*s\n", k, c_SVARG(match[k]));
+ printf("submatch %lld: %.*s\n", k, c_SV(match[k]));
```
There is also a safe macro which simplifies this:
```c
c_formatch (it, &re, input)
c_forrange (k, cregex_captures(&re))
- printf("submatch %lld: %.*s\n", k, c_SVARG(it.match[k]));
+ printf("submatch %lld: %.*s\n", k, c_SV(it.match[k]));
```
## Using cregex in a project