I'm developing a search mechanism to which the search query is provided via a text field. The query is then parsed and the results are presented to the user. I've got the syntax definition covered except for one detail.

What operator (one character, or two at the most) should the user enter to ask whether one string contains another? I've thought about tilde ('~'), but that has met some resistance from some of the other people involved.

I have a problem using a whole word (e.g. 'contains' ...) due to syntax reasons, so that's out of the question.

Any suggestions?

  • Hi @eitanfar, This is a UX board and, as such, does not cover coding or implementation questions - You might want to try stackoverflow.com instead Commented Nov 29, 2015 at 20:26
  • 1
    Hi @AndrewMartin, I wanted your opinion regarding the UX aspect of allowing the user to use '~' as an operator in a search field in the UI of the application. This has nothing to do with coding. I'll appreciate any thought you might have on the issue.
    – ethanfar
    Commented Dec 1, 2015 at 11:39
  • I've made a small edit to your question to clarify the UX angle here but there are still some other questions: who are your users? Do they understand using symbols as operators in searches? Is so, what symbols do they already use? What do you mean by "one string contains another"? Is this a sub-search? - From what I understand (which is probably wrong) Google do the opposite - All searches contain parts of the search terms but you can fix it to an exact phrase using double quotes ("my search term"). Commented Dec 1, 2015 at 12:47
  • Could you provide an actual example with such a search string that contains another text? "~" seems to be the common standard in dictionaries as a placeholder for "the current text/expression/word", but I cannot imagine how it would be used in a search text. Commented Dec 1, 2015 at 13:39
  • Here's a mock scenario that I hope will illustrate what I mean. The user can search for a person's details (in a phone book app, or something like that) by first and last name. If the user would like to search for a "John Doe", he/she could enter (in the search field) the phrase: "first~Jo&last~Do", this should be sufficient to find "John Doe", but the search results would also include: "Josh Donovan" for instance.
    – ethanfar
    Commented Dec 1, 2015 at 14:01

1 Answer 1


The best scenario would be to not give an option for the user to specify if the substring is contained in another. But list results depending on relevancy:

Exact match -> contained strings (substring in another word)

If the feature is meant for more advanced users who know exactly what they are looking for, I find the percentage sign % a known way of looking for substrings and you are presenting the search functionality with advanced options for users to filter better.

  • The whole reason for the syntax in that search field, is to support complicated searches with multiple search expressions (matching all of them), each of which can support multiple fields and values. For instance (continuing my example from the comments on the question) in the phone book app, the user might enter the following search query: "first,last~al&office phone~555&cell phone~412,879" which would result in users that either one or both of their first & last names contains "al", which office phone number contains "555" and which cell phone number contains either "412" or "879" or both.
    – ethanfar
    Commented Dec 1, 2015 at 14:09

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.