diff options
| author | Tyge Løvset <[email protected]> | 2023-02-05 21:21:55 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-05 21:21:55 +0100 |
| commit | e6dfaf1720f6833784d17d5364e1dd76324dff6a (patch) | |
| tree | 0808f479425e58971aef993288bb818e60417422 /docs/cregex_api.md | |
| parent | 217865ae413f9cfcc72af176ec7e98f418bddbea (diff) | |
| download | STC-modified-e6dfaf1720f6833784d17d5364e1dd76324dff6a.tar.gz STC-modified-e6dfaf1720f6833784d17d5364e1dd76324dff6a.zip | |
Some last minute changes: reverted mostly the c_extern from last commit.
Renamed c_ARGSV(sv) macro to c_SVARG(sv). Both available.
Diffstat (limited to 'docs/cregex_api.md')
| -rw-r--r-- | docs/cregex_api.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/cregex_api.md b/docs/cregex_api.md index e74040d8..a115b4af 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_ARGSV(match[0])); + printf("Found date: %.*s\n", c_SVARG(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_ARGSV(match[0])); + printf("Found date: %.*s\n", c_SVARG(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_ARGSV(match[k])); + printf("submatch %lld: %.*s\n", k, c_SVARG(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_ARGSV(it.match[k])); + printf("submatch %lld: %.*s\n", k, c_SVARG(it.match[k])); ``` ## Using cregex in a project |
