Wildcard

Happy New Year All!
What is the difference between the wildcards asterisk (*) and per cent (%) when searching records?

Hi @kitchenprinzessin,

Happy New Year to you as well!

Specify supports 3 primary wild card characters when using Simple Search, the ‘Like’ operator in the Query Builder, and when searching from a query combo box form. The operators behave in the following ways:

Wildcard Represents Placement Restrictions Example Usage Matches Examples
* Zero or more characters Can be used at the start and end of a search string, but not between characters. *123*, 123* *123* matches “Field123”, “Data123Field”, “123Data”; 123* matches “123Data”, “123”; but not “A123B”.
% Zero or more characters Can be used anywhere in the string. %123, 123%, A%BC, A%B% %123 matches “Data123”, “123”; 123% matches “123Data”, “123”; A%BC matches “A123BC”, “ABCD”; A%B% matches “AB”, “A1B”, “A123B234”.
_ A single character Can be used anywhere in the string. h__t, sp____y h__t matches “heat”, “host”; sp____y matches “specify”, “spindly”, where underscores represent any single character.

Breakdown:

  • % (Percent Sign) (Most Flexible): This wildcard offers the most flexibility as it can be used anywhere in the search string. It allows for complex pattern matching and can be repeated multiple times within a single query.

  • * (Asterisk): This wildcard is useful for searching for substrings that may appear at the beginning or end of a string. You can use two asterisks, one at the start and one at the end, but you cannot place an asterisk between characters, which limits its flexibility compared to the other wildcards. If used within a search string, it will be interpreted literally.

  • _ (Underscore): This wildcard is used to represent a single character. It can be placed anywhere in the string, allowing you to search for patterns where only one character is unknown.

3 Likes

The comparison is well described. thanks you @Grant
I also noticed that an asterisk is not supported in the query builder, but % and _. is this correct?