Searching an IMAP object by topic does not match punctuation characters in Gmail

I am using the libraray PHP function imap_search imap_search() to search for emails in a Gmail inbox through the subject line.

 imap_seach($mbox, 'ALL SUBJECT "<search string>"'); 

This search is great for alphanumeric strings, but doesn't work when it has special characters, such as a slash, comma, colon, single quote, hyphen, and many other characters that I don't even know about. Running away from them does not help. Replacing some of them with space helps at one time, but not in all cases.

Is there a standard way to filter a search string so that it never logs out or returns a result? I tried to fake a sting topic and remove all words from the search bar that contain even one alphanumeric character. This basically works, but fails when all words have a non-alphanumeric character (which is common to one or two words).

+4
source share
1 answer

My guess is that GMail searches are based on the idea that only whole alphanumeric words can be used as search strings.

So you will need to remove all non-alphabetic characters from your search bar and this will work ...

+1
source

All Articles