[FR] regular expressions support
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:
- 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
procsoutput 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--andand--oroptions 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" - 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 forExactorPartialand think about--andand--orpriorities. - 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:
- Switching modes options:
--text(current search mode),--regex(regex mode) and--smart(regex autodetection by specific patterns, like | (…), * ? etc) - In regex mode, instead if
[KEYWORD]…, arguments there is a single `<REGEX> argument - Interactive regex-based filtering in watch mode (as for me, this feature can save a lot of time for a complex filtering cases)
Hi Beelze, I am interested in this issue. Could you please assign it to me?
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.
@sabbellasri Thank you for your interesting in this issue.