21 lines
1 KiB
C
21 lines
1 KiB
C
// calogRegex.h -- calog regular-expression library over PCRE2 (Perl-compatible).
|
|
//
|
|
// regexMatch(pattern, subject [, flags]) -> nil | list(fullMatch, group1, ...)
|
|
// regexSearch(pattern, subject [, flags]) -> nil | map{ match, start, end, groups:list }
|
|
// regexReplace(pattern, subject, replacement [, flags]) -> string (replacement: $1 / ${name}; "g" = all)
|
|
// regexSplit(pattern, subject [, flags]) -> list(string)
|
|
//
|
|
// flags is a string of single-letter options: "i" case-insensitive, "m" multiline (^/$ per line),
|
|
// "s" dot-matches-newline, "x" extended (ignore whitespace), and "g" replace-all (regexReplace only).
|
|
// A non-participating capture group is nil. Subjects and results are binary-safe; the natives are
|
|
// inline (they run on the calling context's thread). Matching is interpreted (JIT is not built).
|
|
|
|
#ifndef CALOG_REGEX_H
|
|
#define CALOG_REGEX_H
|
|
|
|
#include "calog.h"
|
|
|
|
// Register the regex natives on a runtime. Idempotent across runtimes (no shared state).
|
|
int32_t calogRegexRegister(CalogT *calog);
|
|
|
|
#endif
|