How to perform an exact search in Google search or any other search engine?

I am looking for a way to select some content copy it to a clipboard then perform an exact search in one search engine which means I need to add quotes.

Feels like, whatever I try the url format is not the right one.

I just do not understand what should I do to make it work after trying many things (variables, filter, other posts forum).

To take care of spaces and other characters that do not belong in URLs, you can use the filter action, set to "Percent Encode for URL".

I use the %SystemClipboard% token here, but it is the same as the less commonly seen %CurrentClipboard% token in your example.

...and you need to add the double-quotes before filtering:

Ah, yes, if an exact phrase search is what @politicus wants – i.e. for the quotes to surround the search term, rather than them perhaps being in the example as part of an attempt to get the URL to work at all.

For completeness...

@politicus -- It does look like what you did should work. Similar patterns do in other actions:

image

And the "Open URL" action can use text tokens as long as they evaluate to a "URL safe" string -- so this is OK if the Clipboard is Hello or Hello%20World, but fails for Hello World:

image

But it all goes pants as soon as you include the double-quote:

image

...and my guess is that is because the "s are URL encoded to %22:

https://www.google.com/search?q=%22%SystemClipboard%%22

...but that really confuses things because KM sees %nn% as the hex code for ", so the string now evaluates as firstly

https://www.google.com/search?q="SystemClipboard%%22

...then, because "escaping" makes %% a literal %

https://www.google.com/search?q="SystemClipboard%22

...which is an utterly bogus URL.

You can get around that by doing your own encoding (remembering that you need to escape the % to get a literal):
image

...which works fine so long as the contents of the Clipboard are a valid URL parameter string (so, again Hello or Hello%20World work, but Hello World fails).

But since a) this is looking really clumsy, and b) for safety's sake you'll want to to URL encode your search term anyway -- much easy include the double-quotes at the encoding stage then include the whole as an unquoted variable.

Most of the above is supposition -- it's inferred from testing and is not down to any knowledge of KM's code! -- so take the details with a large pinch of salt. Just be aware that this sort of thing can happen and that there's usually a way round it.

Thank you so much @Nige_S and @kevinb !

@kevinb answer guided me to solving my problem and @Nige_S answer REALLY added completeness. :grinning:

1 Like