/* ascii_logparse - demonstrates ASCII mode doing what it is actually for: * parsing structured, line-oriented text with named groups, then reading * fields back out by name rather than by remembering a numeric position. * This is the ordinary, common case the other examples in this directory * deliberately are not (they each isolate one less-common feature * instead); it is included so the directory has one example that looks * like typical real-world usage: log filtering and field extraction. */ #include "regexx.h" #include #include static const char *LOG = "2024-01-15 10:23:45 INFO [auth] user 'alice' logged in from 10.0.0.5\n" "2024-01-15 10:24:02 ERROR [db] connection refused to 10.0.0.9:5432\n" "2024-01-15 10:24:03 WARN [auth] repeated login failure for user 'bob'\n" "2024-01-15 10:25:11 ERROR [auth] user 'bob' locked out after 5 failures\n" "2024-01-15 10:26:00 INFO [db] connection pool resized to 32\n"; int main(void) { const char *pattern = "(?P\\d{4}-\\d{2}-\\d{2}) (?P