#1955·subfinder

Add explicit regular-expression result filters for CLI and SDK

Author: root-ManasCreated Sep 27, 2026Updated Sep 27, 2026

Please describe your feature request:

Add explicit -match-regex and -filter-regex options, with corresponding SDK fields, for filtering discovered hostnames using Go regular expressions.

The existing -match and -filter options rewrite dots and stars as wildcard patterns and anchor the expression. They cannot express an ordinary regex unchanged, and comma-separated parsing conflicts with quantifiers such as {1,3}. Keep those options compatible and accept each regex as one value, with repeatable flags for multiple expressions.

Include patterns should be combined with existing wildcard matches using OR; any matching exclusion should take precedence. Invalid patterns should fail during initialization, including SDK initialization.

Describe the use case of this feature:

Select numbered API/web hosts and exclude development environments before active resolution, output, and callbacks:

bash
subfinder -d example.com -match-regex '^(api|web)[0-9]{1,3}\.' -filter-regex '(^|\.)dev\.'

This avoids separately filtering text/JSON output and gives SDK consumers the same selection behavior. An implementation with CLI, SDK, and output regression coverage is ready for review.

Source: projectdiscovery/subfinder