|
libarmutils
1.4
|
Data Structures | |
| struct | REList |
| Regular Expressions List. More... | |
Functions | |
| int | re_compile (regex_t *preg, const char *pattern, int cflags) |
| Wrapper function for regcomp(). | |
| char * | re_error (int errcode, regex_t *preg) |
| Wrapper function for regerror(). | |
| int | re_execute (regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) |
| Wrapper function for regexec(). | |
| void | re_free (regex_t *preg) |
| Wrapper function for regfree(). | |
| void | re_free_substrings (size_t nmatch, char **substrings) |
| Free the substring list returned by re_substrings(). | |
| char ** | re_substrings (const char *string, size_t nmatch, regmatch_t *pmatch) |
| Extract the substrings from a regular expression match. | |
| REList * | relist_compile (REList *re_list, int npatterns, const char **patterns, int cflags) |
| Compile a list of regular expression patterns. | |
| int | relist_execute (REList *re_list, const char *string, int eflags, int *mindex, size_t *nsubs, regmatch_t **pmatch, char ***substrings) |
| Compare a string with a list of regular expressions. | |
| void | relist_free (REList *re_list) |
| Free a regular expressions list. | |
| int re_compile | ( | regex_t * | preg, |
| const char * | pattern, | ||
| int | cflags | ||
| ) |
Wrapper function for regcomp().
See the regcomp man page for more detailed argument descriptions.
Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).
| preg | - pointer to the regex structure to use |
| pattern | - pattern string to compile |
| cflags | - compile flags |
Definition at line 78 of file regex_utils.c.
| char* re_error | ( | int | errcode, |
| regex_t * | preg | ||
| ) |
Wrapper function for regerror().
The memory used by the returned string is dynamically allocated. It is the responsibility of the calling process to free this memory.
Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).
| errcode | - error code returned by re_comp() or re_exec() |
| preg | - pointer to the regular expression that failed |
Definition at line 118 of file regex_utils.c.
| int re_execute | ( | regex_t * | preg, |
| const char * | string, | ||
| size_t | nmatch, | ||
| regmatch_t | pmatch[], | ||
| int | eflags | ||
| ) |
Wrapper function for regexec().
See the regexec man page for more detailed argument descriptions.
Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).
| preg | - pointer to the compiled regular expression |
| string | - string to compare with the regular expression |
| nmatch | - number of substrings to match |
| pmatch | - arrary to store the matching substring offsets |
| eflags | - execute flags |
Definition at line 169 of file regex_utils.c.
| void re_free | ( | regex_t * | preg | ) |
Wrapper function for regfree().
| preg | - pointer to the compiled regular expression |
Definition at line 207 of file regex_utils.c.
| void re_free_substrings | ( | size_t | nmatch, |
| char ** | substrings | ||
| ) |
Free the substring list returned by re_substrings().
| nmatch | - number of substrings in match request |
| substrings | - array of substrings returned by re_substrings() |
Definition at line 218 of file regex_utils.c.
| char** re_substrings | ( | const char * | string, |
| size_t | nmatch, | ||
| regmatch_t * | pmatch | ||
| ) |
Extract the substrings from a regular expression match.
The array of substrings returned by this function must me freed with re_free_substrings().
Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).
| string | - string that matched the regular expression |
| nmatch | - number of substrings in match request |
| pmatch | - arrary that the matching substring offsets were stored in |
Definition at line 247 of file regex_utils.c.
Compile a list of regular expression patterns.
See the regcomp man page for the descriptions of the pattern strings and compile flags.
Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).
| re_list | - pointer to the regular expressions list to add the patterns to, or NULL to create a new list |
| npatterns | - number of patterns to compile |
| patterns | - list of patterns to compile |
| cflags | - compile flags |
Definition at line 318 of file regex_utils.c.
| int relist_execute | ( | REList * | re_list, |
| const char * | string, | ||
| int | eflags, | ||
| int * | mindex, | ||
| size_t * | nsubs, | ||
| regmatch_t ** | pmatch, | ||
| char *** | substrings | ||
| ) |
Compare a string with a list of regular expressions.
For the outputs that are not NULL, this function will return the results for the first regular expression that matches the specified string. The returned pointers to the pmatch and substrings arrays will be valid until the next call to relist_execute() or relist_free().
The pmatch and substrings arrays will have an entry for every parenthesised subexpression for the pattern that was matched (starting at index 1). Entries at index 0 correspond to the entire regular expression. For subexpressions that were not matched, the offsets in the pmatch entry will be -1 and the substrings entry will be NULL.
See the regexec man page for more detailed descriptions of the execute flags and output pmatch array.
Error messages from this function are sent to the message handler (see msngr_init_log() and msngr_init_mail()).
| re_list | - pointer to the regular expressions list |
| string | - string to compare with the regular expression |
| eflags | - execute flags |
| mindex | - output: index of the pattern that was matched |
| nsubs | - output: number of parenthesised subexpressions |
| pmatch | - output: pointer to array of substring offsets |
| substrings | - output: pointer to array of substrings |
Definition at line 452 of file regex_utils.c.
| void relist_free | ( | REList * | re_list | ) |
Free a regular expressions list.
| re_list | - pointer to the regular expressions list |
Definition at line 574 of file regex_utils.c.