diff options
| author | Tyge Løvset <[email protected]> | 2022-09-21 14:54:47 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-09-21 14:54:47 +0200 |
| commit | 307c0a111c8f063032ba90b2a7ae07122e2a2b1a (patch) | |
| tree | 0c989b52d7fe4a87d11dc593df5b16579dd1bd22 /docs/cregex_api.md | |
| parent | a1d6c85b72027c9cd09d6bf0b1e0f7c3942e4aee (diff) | |
| download | STC-modified-307c0a111c8f063032ba90b2a7ae07122e2a2b1a.tar.gz STC-modified-307c0a111c8f063032ba90b2a7ae07122e2a2b1a.zip | |
Recent macro renames:
c_foreach_token() => c_fortoken()
c_foreach_match() => c_formatch()
Added:
c_forfiltered()
c_forpred()
Diffstat (limited to 'docs/cregex_api.md')
| -rw-r--r-- | docs/cregex_api.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/cregex_api.md b/docs/cregex_api.md index 6fd5ba1d..5f7e9136 100644 --- a/docs/cregex_api.md +++ b/docs/cregex_api.md @@ -122,9 +122,9 @@ if (cregex_find_pattern(pattern, input, match, 0)) 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 matches, c_foreach_match +### Iterate through regex matches, *c_formatch* -To iterate multiple matches in an input string, you may use: +To iterate multiple matches in an input string, you may use ```c csview match[5] = {0}; while (cregex_find(&re, input, match, cre_m_next) == cre_success) @@ -133,7 +133,7 @@ while (cregex_find(&re, input, match, cre_m_next) == cre_success) ``` There is also a safe macro which simplifies this: ```c -c_foreach_match (it, &re, input) +c_formatch (it, &re, input) c_forrange (int, k, cregex_captures(&re)) printf("submatch %d: %.*s\n", k, c_ARGsv(it.match[k])); ``` |
