Pattern Matching makes it possible to search not only for particular characters, but also for types of characters such as “any digit” or for characters that meet special conditions such as "occurring at the beginning of a line”.

These generalized searches are performed by using “pattern matching codes” within the search string. Each pattern matching code consists of the special character “|” followed by another character, typically a mnemonic letter.

|” is the “pipe” character, which is Shift-\ on the keyboard. All pattern matching codes begin with this character.

Although the mnemonic letter can be in upper or lower case, for purposes of clarity, all examples show these letters in uppercase.

Most of the pattern matching codes only have a special meaning in the search string; they have no meaning in the replacement string.

If you need “variable” characters in the replacement string, you must use regular expressions.

Examples of search strings using pattern matching

|D|D
Search for two consecutive digits
|!|D|D|D|!|D
Search for next two digit number
|<note
Search for a line beginning with the word "note"
|W|>
Search for whitespace (any number of spaces and tabs) at the end of a line
t|A|A|An
Search for any five letter word beginning in “t” and ending in “n”
|000
Search for the “Null” character (value 000)

Pattern Matching Codes

|A
Match any alphabetic letter, upper or lower case. It supports non-English letters, such as “umlauts”, if CONFIG > Search options > Support non-English characters has been enabled
|B
Match a blank - a single Space or Tab. See also “|W” and “|X
|C
Match any Control Character - a character with an ASCII decimal value of 0 to 31
|D
Match any numeric digit - “0” through “9”. This code does not match “.” or “,”
|F
Match any alphanumeric character - a letter or a digit
G
Match any graphics character - characters with decimal value greater than 128. It is useful for finding stray graphics (8-bit) characters in a file.
|Hhh
Match the character with hexadecimal value ‘hh’. Both digits MUST be present. This code can also be used in the replacement string.
|I
Match any word separator - Space, Tab, any control character, or one of the additional configurable word separators defined by Config_String(WORD_SEP).
|K
Match any (non-standard) control character other than Tab, Carriage-Return and Line-Feed. It is useful for finding stray control characters in a file. See also |C and |G.
|L
Match the “newline” character(s) Carriage-Return and/or Line-Feed depending upon the file type. With Windows/DOS files, the Carriage-Return is optional. Similar to |N
|M
Match multiple characters - zero, one or more characters until the string following the |M is satisfied. Since the match may cover many lines, it may match a huge number of characters. Use |* instead, to match multiple characters on one line. This code is not generally not useful as the first item in a search string. See also |Y and the following sub-topic “Matching Multiple Characters”.