29 lines
719 B
C
29 lines
719 B
C
#ifndef UTILITIEC_REGEX_MATCHSTRUCT_H
|
|
#define UTILITIEC_REGEX_MATCHSTRUCT_H
|
|
|
|
#include "../StringView/StringView.h"
|
|
#include "../dynamicarray/dynamicarray.h"
|
|
|
|
typedef struct RegexCapture_s {
|
|
// potentially unowned string, depending on Regex Options
|
|
char* name;
|
|
size_t number;
|
|
|
|
// Reference to string passed to match()
|
|
StringView match;
|
|
size_t match_start;
|
|
size_t match_end;
|
|
} RegexCapture;
|
|
|
|
typedef struct RegexMatch_s {
|
|
// entire match
|
|
StringView match;
|
|
|
|
// numbered and named captures intermixed, ordered
|
|
DynamicArray captures;
|
|
} RegexMatch;
|
|
|
|
bool RegexMatch_HaveNumberedCapture(RegexMatch* match, size_t number);
|
|
RegexCapture* RegexMatch_GetNumberedCapture(RegexMatch* match, size_t number);
|
|
|
|
#endif
|