Files
tinyblocks/libraries/tinyblocks-regex/include/tb_regex.h
T
mguinhosandClaude Opus 5.5 80bd330766 Comentários: separadores com no máximo "---"
Trechos com quatro ou mais hífens dentro de comentários viram "---"
(strings não mudam).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:24:19 -03:00

41 lines
1.6 KiB
C

/*
* TinyBlocks - tb_regex.h
* Library tinyblocks-regex: expressoes regulares (POSIX ERE) para busca,
* substituicao e divisao de texto. Independente do editor.
*/
#ifndef TINYBLOCKS_REGEX_H
#define TINYBLOCKS_REGEX_H
#include <tinyblocks/tinyblocks.h>
TB_API const TinyBlocks_LibraryDescriptor* tb_regex_get_library(void);
/* -- API C --- */
/* Verdadeiro se o padrao casa em algum ponto do texto. */
TB_API bool tb_regex_test(const char* text, const char* pattern);
/* Verdadeiro se o padrao casa o texto inteiro (ancorado). */
TB_API bool tb_regex_match(const char* text, const char* pattern);
/* Primeiro casamento (malloc; libere com free) ou NULL. */
TB_API char* tb_regex_find(const char* text, const char* pattern);
/* Grupo i do primeiro casamento (0 = casamento inteiro). */
TB_API char* tb_regex_group(const char* text, const char* pattern, int group);
/* Quantidade de grupos de captura do padrao (-1 em erro). */
TB_API int tb_regex_group_count(const char* text, const char* pattern);
/* Numero de casamentos. */
TB_API int tb_regex_count(const char* text, const char* pattern);
/* Substitui todas as ocorrencias. Em `repl`, $0..$9 inserem os grupos e
* $$ insere um '$'. Devolve texto (malloc). */
TB_API char* tb_regex_replace(const char* text, const char* pattern, const char* repl);
/* Divide o texto pelos casamentos; devolve vetor de strings terminado por
* NULL (libere cada item e o vetor). */
TB_API char** tb_regex_split(const char* text, const char* pattern, int* out_count);
TB_API void tb_regex_free_list(char** list);
TB_API const char* tb_regex_last_error(void);
#endif /* TINYBLOCKS_REGEX_H */