Search by exact substring with special characters

Hello

Is there a way to prevent object search from breaking a search query into tokens and instead search for exact substing? For example if I want to search by domain in email field, I would be looking for `john-doe.com` but it will include `john@doe.com` into the results. As I understand it’s intended behavior but I was hoping there’s a way to force matching with full substring instead of each token separately

Hi @CalPalJon :waving_hand:

I had no idea the CONTAINS_TOKEN search operator behaved like this! The same behaviour can be seen in the HubSpot web UI, so I’m guessing this is quite fundamental to the way search works in HubSpot as a system. I find it very strange, but I have validated it through testing and searching the HubSpot Community forum for related posts.

Unfortunately, I’ve not been able to find a clear-cut solution for you. I’ve seen a bit of chatter around the Community requesting regular expression based searching, which would definitely solve your issue. You might like to consider posting or supporting such an idea on the Ideas forum.

In the meantime, assuming the example use case you’ve described resembles your actual case, you might consider searching for exact matches on the Contact property “Email Domain”.

I hope this proves useful. Please let me know if you have any follow-up questions.

Hello and thanks for your reply

I had no idea the CONTAINS_TOKEN search operator behaved like this!

Same. And the worst part is I found this in some forum thread too, not in the docs. This also explains weird behavior of the wildcard - it seems to work inside a single token. So if you search for `john*doe` it won’t match with `john-doe`, only with something like `johnmichaeldoe` or just `johndoe`


you might consider searching for exact matches on the Contact property “Email Domain”.

Didn’t know about this property, it can cover some of our use cases. Thank you!