From 659a7f6c1db8d518e7620958ff4670196157ef70 Mon Sep 17 00:00:00 2001 From: Dhinak G <17605561+dhinakg@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:59:50 -0400 Subject: [PATCH] Finish regex support --- src/extract_standalone.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/extract_standalone.m b/src/extract_standalone.m index b55ce6e..6d9d6bd 100644 --- a/src/extract_standalone.m +++ b/src/extract_standalone.m @@ -89,8 +89,12 @@ static int aa_callback(void* arg, AAEntryMessage message, const char* path, void DBGLOG(@"[%@] Message: %@ (%d), Path: %s", config.function, messageToString(message), message, path); if (config.regex) { - // TODO: Implement - abort(); + NSUInteger ret = [config.regex numberOfMatchesInString:[NSString stringWithUTF8String:path] options:0 + range:NSMakeRange(0, strlen(path))]; + DBGLOG(@"[%@] Path: %s, Regex: %@, Ret: %@", config.function, path, config.regex, ret != 0 ? @"Match" : @"No match"); + if (ret == 0 && message == AA_ENTRY_MESSAGE_EXTRACT_BEGIN) { + return 1; + } } else if (config.filter) { int ret = fnmatch(config.filter.UTF8String, path, 0); DBGLOG(@"[%@] Path: %s, Filter: %@, Ret: %@", config.function, path, config.filter,