Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support proper regex in filtering rules #1016

Closed
fwsmit opened this issue Jan 15, 2022 · 3 comments
Closed

Support proper regex in filtering rules #1016

fwsmit opened this issue Jan 15, 2022 · 3 comments

Comments

@fwsmit
Copy link
Member

fwsmit commented Jan 15, 2022

Dunst currently uses fnmatch(3) for pattern matching in filtering rules. It supports wildcard matching ("*") and on GNU systems you can enable some extended patterns like @(one|two|three) for matching any of a few strings or !(one|two|three) for not matching a few strings. We currently don't enable these extended patterns. It was enabled in #659, but it was decided that fnmatch is not a good solution. The man page also says that it's meant for matching file names, not generic strings.

Compatibility: supporting full regex might pose some minor compatibility problems as non-special characters might become special characters. If that is deemed a problem, a toggle can be implemented for enabling regex matching.

Fixes: #1013
Fixes: #645
Fixes: #658

Related: #659

@fwsmit
Copy link
Member Author

fwsmit commented Jan 15, 2022

The c regex is described in regex(3). By default is uses the POSIX Basic Regular Expression syntax and can be extended to the POSIX Extended Regular Expression syntax.

The main compatibility problem I see is the wildcard needs a character before it to repeat, so instead of * you need to use .*. So I think we need a switch to turn on this regex search for compatibility.

@fwsmit
Copy link
Member Author

fwsmit commented Jan 15, 2022

I've chosen the extended syntax, since it only has a few more special characters and you won't need to backlash things like | for matching multiple strings.

@fwsmit
Copy link
Member Author

fwsmit commented Jan 16, 2022

Implemented by #1017.

@fwsmit fwsmit closed this as completed Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant