Reputation: 611
I use "plus addressing" in gmail often.
It is difficult at times, as the web interface does not default to showing much of the headers aside from a usually truncated From: and To: often displayed as "me". "me" does little good to "at a glance" see if it is a plus addressed email or not.
I am getting false positives in my spam folder, some are plus addressed in format. So [email protected] can end up in the spam folder/tag.
I want to create a filter that matches on the plus, and tell it to never send it to spam. It should be rare that a plus addressed message is spam. At least in theory — I won't know until I test it which I can't do until I figure out the syntax.
So far, I have tried a few regex's. but they grab more than I want. I actually can't even seem to find a way to search for any emails To:[email protected]
.+\+.+\@gmail.com
is as close as I can come but it doesn't work correct, or in a way I can even estimate what gmail is doing. My thought ( on the above regex ) was wildcard (repeating), literal "+" symbol (escaped), wildcard (repeating). But I may be messing up my regex and the first wildcard is being greedy and matching any string.
Suggestions?
Upvotes: 5
Views: 1541
Reputation: 388
If you don't specify start-of-string/end-of-string anchors, the regex should match anywhere within the string. So it should be sufficient to write:
\+
You're right that your .+
will match everything, and leave you with nothing to match against your \+
, for example. You can avoid this by explicitly excluding the terminating symbol from the characters to repeat:
[^+]+\+[^@]+@gmail\.com
where [^x]
means ‘any character but x
’.
Upvotes: 1