Skip to content

Migrate all text filter parameters to regex matching #1068

@markuslf

Description

@markuslf

Goal

Replace all simple string/substring/startswith filter parameters with Python regular expression matching across all plugins. This gives admins more flexibility without requiring separate --ignore-pattern and --ignore-regex parameters.

Background

Some plugins offer both --ignore-pattern (substring match) and --ignore-regex (regex match) for the same purpose, or use substring/startswith matching for filters like --ignore, --command, --username, etc. Regular expressions are a superset of simple strings: httpd as a regex still matches "httpd". Admins who need more power can use httpd|nginx, ^web\d+, or (?i)example without needing a separate parameter.

The procs plugin has already been migrated to regex matching for --argument, --command, and --username (documented as a Breaking Change in the current CHANGELOG).

What needs to change

For each affected plugin:

  1. Replace substring/startswith matching with re.search() (or re.match() where startswith semantics are needed).
  2. Remove duplicate parameters where both --ignore-pattern and --ignore-regex exist for the same purpose. Keep the regex variant.
  3. Update the help text to mention "Uses Python regular expressions." and case-sensitivity.
  4. Document as a Breaking Change: simple filters like --ignore=httpd still work, but special regex characters (., *, (, [, \) in filter values are now interpreted as regex. Use --ignore='server\.local' to match a literal dot.

Backward compatibility

  • Simple strings are valid regexes and match identically: httpd matches "httpd" in both modes.
  • Startswith behavior can be expressed as ^httpd.
  • Exact match can be expressed as ^httpd$.
  • The only breakage is when existing filter values contain regex-special characters that were previously treated as literals (e.g. C:\Windows, server.local, file(1)).

Scope

All plugins that currently use substring, startswith, or in matching for filter parameters. The procs plugin is already done and serves as a reference implementation.

Classification

Breaking Change (next major version).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions