summaryrefslogtreecommitdiffhomepage
path: root/docs/cregex_api.md
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-12-23 23:55:10 +0100
committerTyge Løvset <[email protected]>2022-12-23 23:55:10 +0100
commitd623c6c85071b9af5d607bb5d9aceceaea05220a (patch)
treef20fc3714f86e1553d1103bed6dc8efefcbd9d6b /docs/cregex_api.md
parent5f57d597cd27aef55adbcb3b452973b0c6e33667 (diff)
downloadSTC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.tar.gz
STC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.zip
Experimental uppercase macros.
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 ce218721..1b3c03d6 100644
--- a/docs/cregex_api.md
+++ b/docs/cregex_api.md
@@ -129,19 +129,19 @@ if (cregex_find_pattern(pattern, input, match, CREG_DEFAULT))
To compile, use: `gcc first_match.c src/cregex.c src/utf8code.c`.
In order to use a callback function in the replace call, see `examples/regex_replace.c`.
-### Iterate through regex matches, *c_formatch*
+### Iterate through regex matches, *c_FORMATCH*
To iterate multiple matches in an input string, you may use
```c
csview match[5] = {0};
while (cregex_find(&re, input, match, CREG_M_NEXT) == CREG_OK)
- c_forrange (k, cregex_captures(&re))
+ c_FORRANGE (k, cregex_captures(&re))
printf("submatch %lld: %.*s\n", k, c_ARGSV(match[k]));
```
There is also a safe macro which simplifies this:
```c
-c_formatch (it, &re, input)
- c_forrange (k, cregex_captures(&re))
+c_FORMATCH (it, &re, input)
+ c_FORRANGE (k, cregex_captures(&re))
printf("submatch %lld: %.*s\n", k, c_ARGSV(it.match[k]));
```