summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-12-05 22:17:59 +0100
committerTyge Løvset <[email protected]>2022-12-05 22:17:59 +0100
commit0eadaa1220e1ba0382638067aaf8566c216765fd (patch)
tree5c85ee0180526184084196ff0d2da5462e02bcd2 /docs
parent11b835f89aca22d7d42edefbf31ca7e6d0d61b61 (diff)
downloadSTC-modified-0eadaa1220e1ba0382638067aaf8566c216765fd.tar.gz
STC-modified-0eadaa1220e1ba0382638067aaf8566c216765fd.zip
Minor corrections/changes.
Diffstat (limited to 'docs')
-rw-r--r--docs/cregex_api.md7
1 files changed, 3 insertions, 4 deletions
diff --git a/docs/cregex_api.md b/docs/cregex_api.md
index feb17a9a..f1fd7461 100644
--- a/docs/cregex_api.md
+++ b/docs/cregex_api.md
@@ -86,9 +86,9 @@ If an error occurs ```cregex_compile``` returns a negative value, see error code
### Getting the first match
```c
-#define i_implement
-#include <stc/cstr.h>
+#define i_extern // include external utf8 and cregex functions implementation.
#include <stc/cregex.h>
+#include <stc/cstr.h>
int main() {
const char* input = "start date is 2023-03-01, and end date is 2025-12-31.";
@@ -104,7 +104,7 @@ int main() {
printf("Could not find any date\n");
// Lets change all dates into US date format MM/DD/YYYY:
- cstr us_input = cregex_replace(&re, input, "$2/$3/$1");
+ cstr us_input = cregex_replace(&re, input, "$2/$3/$1", 0);
printf("US input: %s\n", cstr_str(&us_input));
// Free allocated data
@@ -112,7 +112,6 @@ int main() {
cregex_drop(&re);
}
```
-
For a single match you may use the all-in-one function:
```c
if (cregex_find_pattern(pattern, input, match, cre_default))