Pattern matching

Author-it Knowledge Center

Platform_KC
On Premises

Pattern matching enables you to use wildcard characters, character lists, or character ranges, in any combination, to search for a string.

The following table shows the characters you can use:

Use the Characters

To Match

?

Any single character.

*

Zero or more characters.

#

Any single digit (0 - 9).

[charlist]

Any single character in charlist.

[!charlist]

Any single character not in charlist.

A group of one or more characters enclosed in [ ] square brackets (also referred to as a charlist) can be used to match any one of the characters in the brackets. You can use a hyphen (-) to specify a range of characters, such as 1-9, or A-Z. For example, if you wanted to find the styles List Bullet 1, List Bullet 2, and List Bullet 3, you could use the string list bullet[1-3] or *bullet[1-3].

Important: The string is not case sensitive.

  • To match a left square bracket ([), question mark (?), number sign (#), or asterisk (*) character, enclose it in brackets.
  • Use an exclamation point (!) at the beginning of the charlist to indicate that a match should only be made if any character except the ones in charlist are found in the string. Use an exclamation point outside the charlist, to indicate the exclamation point must match itself.
  • A hyphen is used to identify a range of characters, unless it appears at the beginning (after an exclamation point if one is used) or at the end of charlist, in which case it will match itself.
  • The character sequence [] is not a valid string.