|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
#include <wireshark.h>Go to the source code of this file.
Macros | |
| #define | WS_REGEX_CASELESS (1U << 0) |
| Enables case-insensitive matching. | |
| #define | WS_REGEX_NEVER_UTF (1U << 1) |
| Disables UTF-8 mode, even if requested in the pattern. | |
| #define | WS_REGEX_ANCHORED (1U << 2) |
| Anchors the pattern to the start of the subject string. | |
Typedefs | |
| typedef struct _ws_regex | ws_regex_t |
Functions | |
| WS_DLL_PUBLIC ws_regex_t * | ws_regex_compile (const char *patt, char **errmsg) |
| Compiles a regular expression pattern. | |
| WS_DLL_PUBLIC ws_regex_t * | ws_regex_compile_ex (const char *patt, ssize_t size, char **errmsg, unsigned flags) |
| Compiles a regular expression with extended options. | |
| WS_DLL_PUBLIC bool | ws_regex_matches (const ws_regex_t *re, const char *subj) |
| Matches a null-terminated subject string against a compiled regex. | |
| WS_DLL_PUBLIC bool | ws_regex_matches_length (const ws_regex_t *re, const char *subj, ssize_t subj_length) |
| Matches a subject string of specified length against a compiled regex. | |
| WS_DLL_PUBLIC bool | ws_regex_matches_pos (const ws_regex_t *re, const char *subj, ssize_t subj_length, size_t subj_offset, size_t pos_vect[2]) |
| Finds the position of a match within a subject string. | |
| WS_DLL_PUBLIC void | ws_regex_free (ws_regex_t *re) |
| Frees a compiled regex object. | |
| WS_DLL_PUBLIC const char * | ws_regex_pattern (const ws_regex_t *re) |
| Returns the original pattern string from a compiled regex. | |
Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs
SPDX-License-Identifier: GPL-2.0-or-later
| WS_DLL_PUBLIC ws_regex_t * ws_regex_compile | ( | const char * | patt, |
| char ** | errmsg | ||
| ) |
Compiles a regular expression pattern.
Parses and compiles the given null-terminated pattern string into a regex object. On failure, sets an error message in errmsg.
| patt | The pattern string to compile. |
| errmsg | Pointer to a string for error reporting (set on failure). |
| WS_DLL_PUBLIC ws_regex_t * ws_regex_compile_ex | ( | const char * | patt, |
| ssize_t | size, | ||
| char ** | errmsg, | ||
| unsigned | flags | ||
| ) |
Compiles a regular expression with extended options.
Compiles a pattern of specified length with optional flags for case sensitivity, UTF-8 handling, and anchoring. On failure, sets an error message in errmsg.
| patt | The pattern string to compile. |
| size | Length of the pattern string. |
| errmsg | Pointer to a string for error reporting (set on failure). |
| flags | Bitmask of WS_REGEX_* options. |
| WS_DLL_PUBLIC void ws_regex_free | ( | ws_regex_t * | re | ) |
Frees a compiled regex object.
Releases memory associated with the compiled regex.
| re | Pointer to the regex object to free. |
| WS_DLL_PUBLIC bool ws_regex_matches | ( | const ws_regex_t * | re, |
| const char * | subj | ||
| ) |
Matches a null-terminated subject string against a compiled regex.
Tests whether the subject string matches the compiled pattern.
| re | Pointer to the compiled regex object. |
| subj | Null-terminated subject string to match. |
| WS_DLL_PUBLIC bool ws_regex_matches_length | ( | const ws_regex_t * | re, |
| const char * | subj, | ||
| ssize_t | subj_length | ||
| ) |
Matches a subject string of specified length against a compiled regex.
Tests whether the subject string matches the compiled pattern, using explicit length.
| re | Pointer to the compiled regex object. |
| subj | Subject string to match. |
| subj_length | Length of the subject string in bytes. |
| WS_DLL_PUBLIC bool ws_regex_matches_pos | ( | const ws_regex_t * | re, |
| const char * | subj, | ||
| ssize_t | subj_length, | ||
| size_t | subj_offset, | ||
| size_t | pos_vect[2] | ||
| ) |
Finds the position of a match within a subject string.
Returns the start and end positions of the first match in pos_vect. Handles lookbehind correctly when using subj_offset.
pos_vect[0] is the start index, pos_vect[1] is the end index. The difference is the match length.| re | Pointer to the compiled regex object. |
| subj | Subject string to match. |
| subj_length | Length of the subject string. |
| subj_offset | Offset into the subject string to begin matching. |
| pos_vect | Output array of two size_t values for match positions. |
| WS_DLL_PUBLIC const char * ws_regex_pattern | ( | const ws_regex_t * | re | ) |
Returns the original pattern string from a compiled regex.
Retrieves the pattern used to compile the regex object.
| re | Pointer to the compiled regex object. |