I have an application that presents a list of items and multiple filtering criteria.

Some of the filtering criteria take a string value for the filter, and the application currently supports basic wildcarding (* for anything, ? for any single character within a search term).

I've been asked to provide two changes to the syntax/capabilities for all fields that take a string:

  • Allow searching for reserved characters (treat ? as a ? rather than as a wildcarded character, same for *: have some way to treat it as an asterisk instead of a wildcard.

  • Support basic 'Or' functionality specified within the search term. That is, match it if the value is 'String A' or 'String B'

I was considering wrapping the string in quotes for treating it as a literal.

e.g. "Question?" would only match 'Question?' but not 'Questions' as it currently does.

I have only come up with ideas for the 'Or' functionality like using a pipe | character between search terms. I'd love something better.

Ultimately, I can do whatever, but I'm wondering if there's some sort of existing convention that would be simple, clear, obvious or ideally all of those.

So, my question is: is there an existing syntax convention for search terms that allows wildcarding, literals, and alternatives that I could use rather than coming up with my own?

The target user base would be something akin to a sysadmin. I don't want something as complicated as regular expressions, but the application won't be used by someone's grandma... unless that grandma is a sysadmin, I guess.

  • 2
    This really depends on who your customers are. The * and ? placeholders originate from DOS; programmers tend to favor regular expressions syntax. – Pasha Apr 3 '13 at 18:14
  • They're not developers. It would be closer to sysadmin types, and regex would be too complicated. I'm looking for something simple. – Shawn D. Apr 3 '13 at 18:30

When it comes to search - there can be only one reference (sorry Bing and Yahoo). Google have a well documented guide what to use, and implicitly what not to use. Typically the asterix (*) means filling in the blank which is the same as wildcard, so that'll do. But using a question mark is not accounted for, so don't use that.

Quotations (" ") for an entire phrase, OR-statements, minus sign (-) for exclude, tilde sign (~) for similar, and two dots (..) for number range can also be used.

However, I'd be very careful to use a lot of characters for different "clever" meanings. I'd use quotations and wildcard only and skip the rest. But to be certain, and really know what is used, consult your search query log to know what your users use. That's the only way to be really sure.


In programming (or doing anything with special characters), there is often a way in which you can escape the special character so that it reverts to just being text. Often this is done by prepending the character with a special symbol (often \). (Note: you have to be able to escape the escape - often this is just the special character repeated twice).

In your case, I could see this method working out - the question is whether or not your default interpretation of special characters should be as text or the commands they represent (i.e., should * mean wildcard by default, or should \* mean wildcard). The answer is probably whichever usage is more common and convenient for your users.


If the audience is System Admins and similar types - consider using a distilled form of SQL. That should be very familiar to admins and sysops


Have a look at the Advanced Search of CSA Illumina. It uses boolean as well as positional operators and wildcards. To search for the wildcards themselves, the terms are simply put into quotes, as you did. That is quite intuitive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.