1

I'm subscribed to a mailing list which sends me very often emails with this subject format:

A B $ x: Phrase

Where A is a word, B in another word different from A, $ is a currency symbol, x is a decimal number (such as 0.15 or 21.63 or 155.01), : is the colon symbol and Phrase is a generic phrase.

The decimal number and the phrase change in every email.

I'd like to put all the emails coming from this mailing list having x greater than 5 into a folder and all the emails coming from this mailing list having x less than 5 into another folder.

I tried using the advice found at this link, and this is what I came up with:

-{subject:("A B $ 0.") subject:("A B $ 1.")} subject:("A B $ 2.") subject:("A B $ 3.") subject:("A B $ 4.") subject:("A B $ 5.")}

I put this line in the Subject field of the Gmail filter to get the emails with x greater than 5, but it doesn't seem to work. I also tried to put this line in the Subject field:

-{"A B $ 0." "A B $ 1." "A B $ 2." "A B $ 3." "A B $ 4." "A B $ 5."}

But again it doesn't seem to work.

What should I do? Any advice?

UPDATE

I've tried doing what user Blind Spots suggests, but it didn't work. So I'm providing some samples of the actual subject and more info.

I'm subscribed to the Keepa mailing list (a tool to track Amazon prices). The emails this tool sends me are in this format:

Price alert € x: TitleOfItem

Where, again, x is a decimal number followed by a colon and the title of the item tracked.

Putting the line:

from:([email protected]) subject:({Price.alert.€.0 Price.alert.€.1 Price.alert.€.2 Price.alert.€.3 Price.alert.€.4})

or the line:

from:([email protected]) subject:({Price.alert.€.5 Price.alert.€.6 Price.alert.€.7 Price.alert.€.8 Price.alert.€.9})

in the search bar doesn't find the correct emails, neither putting it into the Has the words field of a filter does, even though putting the first line in the search bar finds more emails than putting the first line into the filter field.

Here are some sample email subjects:

Price alert € 8.79: ...
Price alert € 3.80: ...
Price alert € 5.98: ...
Price alert € 20.86: ...
1
  • I updated my answer after completing additional testing based on the information you provided.
    – Blindspots
    Commented Nov 23, 2022 at 21:50

1 Answer 1

0

You cannot currently perform a SEARCH in HTML Gmail to get the results you want.

  1. Gmail will not find the symbol.
  2. Gmail will not find an incomplete number.

It ignores periods normally . however when it comes to numbers it will not find a decimal number unless you search for it in its entirety.

search: subject:(20)
will find 20 20. 20, 20,2 2,20 20 Love
won't find 20.1 120 12.20

Unfortunately, determining what does and doesn't work for Gmail searches is often a case of painstaking testing, and there is no guarantee that what works today will work tomorrow and vice versa.

What you want can be done using REGEX and Apps Script. If this is important to you let me know and I can adapt one of my scripts to label the messages according to whatever categories you want and then you can filter/search based on the applied labels.

5
  • Unfortunately it didn't work, I added more info into the post.
    – SuperFluo
    Commented Nov 23, 2022 at 11:15
  • 1
    Thank you very much for your help. Indeed I also thought this could not be done without regex before asking the question. The issue is not so important to me, and I also found that gmail provides API to interact with emails, so I may start looking for a way to do this via a script (I'm familiar with code, scripts and regex). But some advice would still be helpful, thank you!
    – SuperFluo
    Commented Nov 24, 2022 at 21:05
  • Various approaches but start with a API search using similar format to Gmail e.g. newPAmsgs = Gmail.Users.Messages.list("me", { "q": "from:([email protected]) subject:(Price Alert) -label:pricealert-less -label:pricealert-greater"}).messages and then newPAmsgs.forEach(thisMsg => idsList.push(thisMsg.id)) gets you array of msg IDs which you use to retrieve the subjects to regex. idsListLess.forEach(thisID => Gmail.Users.Messages.modify({ 'addLabelIds': [pricealeret-less_ID] }, 'me', thisID ) (or maybe Gmail.Users.Messages.batchModify if you prefer) to add the right label.
    – Blindspots
    Commented Nov 25, 2022 at 6:34
  • sorry on the road but can give you a bit more when back after weekend,.
    – Blindspots
    Commented Nov 25, 2022 at 6:38
  • Thanks a lot! You've been so kind!
    – SuperFluo
    Commented Nov 30, 2022 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.