From 255b77756305cf807a6d2b040ab71788f0139f0f Mon Sep 17 00:00:00 2001 From: Steffen Date: Wed, 20 Mar 2024 15:21:22 +0100 Subject: Add regex filtering Filters starting with '!' will try to match processes pid, name, cmd and user with extended regex as defined by the C++ standard. A single '!' will not filter. --- src/freebsd/btop_collect.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/freebsd') diff --git a/src/freebsd/btop_collect.cpp b/src/freebsd/btop_collect.cpp index a99f8df..b4034c7 100644 --- a/src/freebsd/btop_collect.cpp +++ b/src/freebsd/btop_collect.cpp @@ -1239,18 +1239,13 @@ namespace Proc { filter_found = 0; for (auto& p : current_procs) { if (not tree and not filter.empty()) { - if (not s_contains_ic(to_string(p.pid), filter) - and not s_contains_ic(p.name, filter) - and not s_contains_ic(p.cmd, filter) - and not s_contains_ic(p.user, filter)) { - p.filtered = true; - filter_found++; - } - else { - p.filtered = false; - } + if (!matches_filter(p, filter)) { + p.filtered = true; + filter_found++; + } else { + p.filtered = false; } - else { + } else { p.filtered = false; } } -- cgit v1.2.3