#include "regex.h" #include #include static regex_t compiled; const char *regex_pattern = "^\\(https\\?://\\)\\?docs\\.\\(new/*\\|google\\.com/document/d/[-0-9A-Z_a-z]\\+\\(/\\(edit\\|view\\|preview\\|copy\\|mobilebasic\\|template/preview\\)\\?\\)\\?\\(?\\([^%]\\|%[0-9A-Fa-f][0-9A-Fa-f]\\)*\\)\\?\\)$"; static void __attribute__((constructor)) init (void) { regcomp (&compiled, regex_pattern, REG_NOSUB); } bool regex_match (const char *string) { return !regexec (&compiled, string, 0, NULL, 0); }