[SOLVED] Mail Filter / Regular expression error

abzsol

Well-Known Member
Sep 18, 2019
94
6
48
Italy
www.abzsol.com
Hello everyone,
I'm trying to insert a regular expression inside Mail Filter but I get this error

invalid regex: ^* matches null string many times in regex; marked by <-- HERE in m/^* <-- HERE [B]domain.ext[/B]$/ at /usr/share/perl5/PMG/Utils.pm line 1590. (500)

What am I doing wrong?
Thanks in advance.
 
Well ^* does not really make sense as a regex. * is a quantifier and needs something to quantify. It matches whatever is before it zero to many times. ^ just matches the beginnings of lines so this can only be matched ones per line.

What is it that you want to match with your regex?
 
Well ^* does not really make sense as a regex. * is a quantifier and needs something to quantify. It matches whatever is before it zero to many times. ^ just matches the beginnings of lines so this can only be matched ones per line.

What is it that you want to match with your regex?
I just want to match everything that ends with domain.ext ;)
I've always inserted it in PMG 7 as *domain.ext, now with version 8 is not working.
 
I've always inserted it in PMG 7 as *domain.ext, now with version 8 is not working.
We added a check to see if your regex is valid with PMG 8, so this regex never really worked, the check just didn't exist.

What you could do is this: .*domain\.ext. .* will match any letter or digit zero or multiple times. You'll also need to escape the . as otherwise it matches any character. So .*domain.ext is a valid regex but will also match .*domainPext and .*domain4ext for example. You can check how your regex works on a site like regex101 [1].

[1]: https://regex101.com/
 
Last edited:
We added a check to see if your regex is valid with PMG 8, so this regex never really worked, the check just didn't exist.

What you could do is this: .*domain\.ext. .* will match any letter or digit zero or multiple times. You'll also need to escape the . as otherwise it matches any character. So .*domain.ext is a valid regex but will also match .*domainPext and .*domain4ext for example. You can check how your regex works on a site like regex101 [1].

[1]: https://regex101.com/
Thanks @sterzy
So I have to edit all the regexes I entered incorrectly with version 7? :(
 
So I have to edit all the regexes I entered incorrectly with version 7? :(
Well, probably yeah, otherwise they probably don't do what you expect them to do.
 
Hey,

yeah, the regex gets “anchored” by PMG. Meaning that it always adds a “^” at the beginning and a “$” at the end. “^” matches the beginning of a line and “$” matches the end of a line. So the regex you provide matches a string that starts with “@schimmel” followed by an arbitrary character because of the “.”. What you'd want is something like “.+@(?:.+\.)?schimmel\..+”. That would get transformed to the following regex by PMG: “^.+@(?:.+\.)?schimmel\..+$”. You can check out how that regex behaves on regex101 [1].

[1]: https://regex101.com/r/uAlXDN/2
 
Last edited: