procs icon indicating copy to clipboard operation
procs copied to clipboard

[FR] regular expressions support

Open beelze opened this issue 2 years ago • 3 comments

procs has a well-developed and consistent search logic that covers many use cases. Though, it is not rare when "grepping" may be more familiar and convenient. But because of watching mode and headers, grep is not suitable.

The idea is to add new regex filtering mode, leave current numeric/textual search as is. The reasons are:

  1. Regexes may be easier to write. As I said, for those who often "greps" logs (for instance) regexes are familiar, powerful and flexible way of filtering. And procs output is very similar to logs. I've come to this when I tried to watch for spawning and killing instances of two binaries while messing with processed like man or emacs which has same strings in command lines. A lot of --and and --or options plus adding spaces did the trick but it took some time. And here I thought "It would be nice to did the same with a simple regex"
  2. Regexes are flexible. For instance, watching for some processes by state and name could be tricky but (assuming the string we're testing with regex is columns joined with space) I can easily write something like ( S .*Rambox| D .*firefox). Currently I need to check my config for Exact or Partial and think about --and and --or priorities.
  3. Of course, it is opinion-based, but for most complex cases regexes are shorter and more predictable comparing to combination of logical conditions.

Desired implementation:

  1. Switching modes options: --text (current search mode), --regex (regex mode) and --smart (regex autodetection by specific patterns, like | (…), * ? etc)
  2. In regex mode, instead if [KEYWORD]…, arguments there is a single `<REGEX> argument
  3. Interactive regex-based filtering in watch mode (as for me, this feature can save a lot of time for a complex filtering cases)

beelze avatar Nov 02 '23 00:11 beelze

Hi Beelze, I am interested in this issue. Could you please assign it to me?

sabbellasri avatar Nov 23 '23 00:11 sabbellasri

Hi Beelze, I am interested in this issue. Could you please assign it to me?

Sorry, but I have no permissions for that. Please ask @dalance instead.

beelze avatar Nov 23 '23 14:11 beelze

@sabbellasri Thank you for your interesting in this issue.

dalance avatar Nov 24 '23 00:11 dalance