Getting Wild(card) with Advanced Searching

CiviCRM Advanced Search offers two wildcard characters: the percentage symbol (%) and an underscore (_). A wildcard is a single character that can represent one or a number of characters or an empty string of unknown characters. For many of us, we are used to the asterisk (*) as being the wildcard character from old command line computers but in CiviCRM, the percentage symbol (%) and an underscore (_) are used. 

The percent symbol (%) represents any character or characters that could be found in its place or after it. For example, searching the name for Ste%e will return Stephen, Steve, Steven, Stevenson. Or, if the wildcard character % is put in front of %ate, the search could find words such as: gate(s), hate, late, mate(s), rate, state(s), etc.

wildcard_example.png

The underscore ( _ ) represents a single character.  For example Ste_e could be Steve, Steven, Stevenson but not Stephen.  

wildcard_underscore_example.png

We can also combine the wildcards or use them more than once in the same field. T_e% would find all strings that start with a T, have any valid character in the second position, followed by an e in the third position, and then any number of characters after that. So the, tree and ties, and tie the knot would all be matches, but Thierry would not because the e is in the fourth position in the string.

Apply this trick: Some of the fields you can search in using these characters are Complete or Partial Name, Source, Job Tittle, City, and custom text fields.