Struggling with Query Rules

Hello! All of my search experience’s query rules seem to be working except for one.

The problematic rule uses the following regex as the search term criteria:

/(?<![a-zA-Z0-9])((cancel|canceling) (my|the|this) (order|print job|job|print))(?![a-zA-Z0-9])/gm

It has 2 actions that each boost an entity belonging to a different vertical. One of the entities is shown in the search results like normal, but the other one does not appear in any of the searches I’ve tried that match the regex.

The entity does appear in the search results if i deliberately misspell one of the words in the search term however. For example, if I search for “cancel my print jon” or “canceling my orde” then the entity will appear in the search results.

Does anyone know why this might be the case?

What’s the rationale for the negative look behind and the negative look ahead? It should still work, but I wonder if it’s possible that Yext isn’t interpreting the regex correctly as it is. Have you tried something as simple as the following?

(cancel|canceling).(my|the|this).(order|print job|job|print)
1 Like

Thanks for your reply.

The regex you provided works in all cases that I have tested, and Yext seems to comprehend it as well. I am new to regex so it is good to learn that a more simple expression can be just as effective (if not more) than a more complicated one.

I appreciate your help. Thank you!