Regex filter exclude file extension case insensitive

Hi, I’m trying to exclude some file extension with regex. I get it to work case sensitiv but I would like to have it case insensitive.

this is working case sensitive:

-[.*\.(pdf|jpg)$]

so I read that I have to use (?i) for case insensitive, but I did get it to work. I tried the following:

-[(?i).*\.(pdf|jpg)$]
-[.*\.(?i)(pdf|jpg)$]

both doesn’t catch anything.
What I’m doing wrong?

Welcome to the forum @barthaare

What OS? What Duplicati? Where are you typing or seeing the expressions you show?
If using the Duplicati GUI Source Data Filters, confirm with three-dot menu Edit as Text.
The TEST-FILTERS command can test a set of files using --exclude instead of minus.
Works fine for me on Linux. Can you create a test folder where it’s not working for you?

Hi, I’m running duplicati 2.0.8.1_beta_2024-05-07 through docker on openmediavault 7.4.5-1 with Kernel 6.1.0-23-amd64. I was using Edit as Text to input the regex. I will check with TEST-FILTERS command. Unfortunately I have to wait till my current backup is completed. Maybe it’s only the “preview” in the config window which isn’t working correctly.

I’d guess that is because the GUI regex uses JavaScript and doesn’t support that.

Why is the regex invalid in javascript? /(?i)-StringA$|-StringB$/ [duplicate]

Inline Modifiers: (?isx-m)

All popular regex flavors apart from JavaScript support inline modifiers, which allow you to tell the engine, in a pattern, to change how to interpret the pattern. For instance, (?i) turns on case-insensitivity.

The link in the above citation lists some other things that may fail. I’m not sure how fixable this is, however feel free to open an issue to see if the development team is interested in improving this.

That is plausible. The .NET regex engine should support either of the two regex’s you posted.
I tested with regex101.com which has a .NET 7 evaluator.

I don’t really do JavaScript, but the exception (which it’s about to ignore) seems to be like this:

Expecting JavaScript and C# regular expressions to match probably only works for basic things.
JavaScript link above leads to XRegExp which looks like it can do inline modifiers at start of RE.
Full compatibility with C# might need C# regex engine, which might require transferring file data.

Yes, it looks like we did not anticipate anything more than vanilla RegEx. In any case, we need to send data to the backend to execute the filters, otherwise there can be tiny deviations.

I tried TEST-FILTERS command and it worked.