This commit is contained in:
anon 2023-09-26 16:18:38 +02:00
parent 99127233db
commit e4106e1a69

View File

@ -9,20 +9,26 @@ match_t * regex_match(const regex_t * const regex, const char * const string, co
``` ```
Returns a sentinel terminated array of `match_t` objects. Returns a sentinel terminated array of `match_t` objects.
The sentinel object is defined as `(match_t){ .position = -1, .width = -1, };`. The sentinel object is defined as `(match_t){ .position = -1, .width = -1, };`.
The position and width of non-sentinel `match_t`s is guaranteed to be => 0.
```C
bool is_sentinel(const match_t * const match);
```
This is the function you must check whether a `match_t` is a sentinel or not.
I.e. make this the break condition while looping the results.
| Symbol | Meaning (TODO: fill in) | | Symbol | Meaning (TODO: fill in) |
| :----: | :---------------------: | | :----: | :---------------------: |
| . | | | . | |
| = | | | ? | One or zero of the previous token |
| + | | | = | Same as ? |
| * | | | * | Any number of the previous token |
| ? | | | + | One or more of the previous token |
| \\< | | | \\< | Start of word |
| \\> | | | \\> | End of word |
| ^ | | | ^ | Start of string |
| \t | | | \t | Tab |
| \n | | | \n | New line |
| \b | | | \b | |
| \i | | | \i | |
| \I | | | \I | |
@ -33,19 +39,19 @@ The position and width of non-sentinel `match_t`s is guaranteed to be => 0.
| \p | | | \p | |
| \P | | | \P | |
| \s | | | \s | |
| \d | | | \d | Digit char |
| \D | | | \D | Not digit char |
| \x | | | \x | Hex char|
| \X | | | \X | Not hex char |
| \o | | | \o | Octal char |
| \O | | | \O | Not octal char |
| \w | | | \w | Word char|
| \W | | | \W | Not word char|
| \h | | | \h | |
| \a | | | \a | Ascii letter |
| \l | | | \l | Lowercase ascii letter |
| \L | | | \L | Not (lowercase ascii letter) |
| \u | | | \u | Uppercase ascii letter |
| \U | | | \U | Not (uppercase ascii letter) |
| [\<range\>] | | | [\<range\>] | Any of \<range\> |
| [\^\<range\>] | | | [\^\<range\>] | None of \<range\> |