ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
pcre2.h
Go to the documentation of this file.
1
12#pragma once
13
14#define PCRE2_CODE_UNIT_WIDTH 8
15#include <pcre2.h>
16#include <stdbool.h>
17
26
53
64
72
82
90
117char *asciichat_pcre2_extract_named_group(pcre2_code *regex, pcre2_match_data *match_data, const char *group_name,
118 const char *subject);
119
140char *asciichat_pcre2_extract_group(pcre2_match_data *match_data, int group_num, const char *subject);
141
164const char *asciichat_pcre2_extract_group_ptr(pcre2_match_data *match_data, int group_num, const char *subject,
165 size_t *out_len);
166
187bool asciichat_pcre2_extract_group_ulong(pcre2_match_data *match_data, int group_num, const char *subject,
188 unsigned long *out_value);
189
194int asciichat_pcre2_match(const pcre2_code *code, PCRE2_SPTR subject, PCRE2_SIZE length, PCRE2_SIZE startoffset,
195 uint32_t options, pcre2_match_data *match_data, pcre2_match_context *context);
unsigned int uint32_t
Definition common.h:58
🔍 Centralized PCRE2 singleton pattern for efficient regex compilation
pcre2_code * asciichat_pcre2_singleton_get_code(pcre2_singleton_t *singleton)
Get the compiled pcre2_code from a singleton handle.
Definition pcre2.c:98
bool asciichat_pcre2_singleton_is_initialized(pcre2_singleton_t *singleton)
Check if a singleton was successfully initialized.
Definition pcre2.c:170
int asciichat_pcre2_match(const pcre2_code *code, PCRE2_SPTR subject, PCRE2_SIZE length, PCRE2_SIZE startoffset, uint32_t options, pcre2_match_data *match_data, pcre2_match_context *context)
Definition pcre2.c:399
void asciichat_pcre2_cleanup_all(void)
Free all PCRE2 singletons.
Definition pcre2.c:214
char * asciichat_pcre2_extract_group(pcre2_match_data *match_data, int group_num, const char *subject)
Extract numbered capture group as allocated string.
Definition pcre2.c:308
char * asciichat_pcre2_extract_named_group(pcre2_code *regex, pcre2_match_data *match_data, const char *group_name, const char *subject)
Extract named substring from PCRE2 match data.
Definition pcre2.c:269
const char * asciichat_pcre2_extract_group_ptr(pcre2_match_data *match_data, int group_num, const char *subject, size_t *out_len)
Extract numbered capture group as pointer into subject (non-allocating)
Definition pcre2.c:339
bool asciichat_pcre2_extract_group_ulong(pcre2_match_data *match_data, int group_num, const char *subject, unsigned long *out_value)
Extract numbered capture group and convert to unsigned long.
Definition pcre2.c:361
pcre2_singleton_t * asciichat_pcre2_singleton_compile(const char *pattern, uint32_t flags)
Compile and cache a PCRE2 regex pattern with thread-safe singleton semantics.
Definition pcre2.c:47
void asciichat_pcre2_singleton_free(pcre2_singleton_t *singleton)
Free a PCRE2 singleton and its resources.
Definition pcre2.c:185
ClangTool/LibTooling compatibility shim for stdbool.h.
Represents a thread-safe compiled PCRE2 regex singleton.
Definition pcre2.c:22
char * pattern
Pattern string (owned by singleton, dynamically allocated)
Definition pcre2.c:26
uint32_t flags
PCRE2 compile flags.
Definition pcre2.c:27
atomic_t code
Compiled regex (lazy init, atomic pointer as uint64_t)
Definition pcre2.c:24