Find and Replace

On the File | File Editor tab, in the Search group: Click Replace (CTRL + H) to find and replace the occurrences of a specified value or search string in the fields of a file.

This option is also available on the Lookup Table Editor tab for Lookup Tables.

Find What

Enter the value of the search string in Find What. Any searches you make in the current session are available for selection in a drop-down History list attached to the input box. You can include wildcard characters in the search string to generalise the search.

The Find and Replace form

Examples are shown in the tables below.

Possible matches will depend on whether:

  • You want to Match on the start of a field, part of a field, or a whole field. NOTE: These Match options are redundant if the '$' wildcard is used (see below) or if you are using regular expressions (see below).
  • You have selected the Match case check box option. Case refers to whether the letters which make up the search string are ‘UPPER CASE’ , ‘lower case’, or a mixture of the two. Rc001, for example, is considered to be different to RC001 when the Match case option is selected.
  • The Direction of the search is correct, given your current row position in the file. All is the default direction setting. The SELECTION option is enabled if you have selected a block of rows in the file. If rows are selected, the direction of the search begins at the first selected (highlighted) row in the grid.
  • You want to Search all fields or just the field currently selected in the editor window.
  • You want to Use regular expressions. A regular expression is a search string that uses special characters to match patterns of text. You can use them as an alternative to wildcards.

Wildcards

You can use wildcards to select multiple files, find field values in a file, or filter the selection when creating colour, hatch, or symbols sets:

Meaning Char Example Finds
Match any number of characters. * R* R, RA, R123, RCH02, etc.
Match any number of characters preceding suffix.. * *ABC DEFABC
Match prefix followed by any number of characters (same as ^ABC) * ABC* ABCDEF
Match any single alphabetic character. ? R?C R1C, R C, ROC, etc.
Match any numbers of characters except zero. + R+ R1, RA, RABC, etc.
Match any string containing a given substring (same as *ABC*) $ $R ARC, ROC, BAR, 94RC02, etc.
Match any string NOT containing a given substring. ! !R 1, 20, ABC, etc.
Match substring at start of string (same as ABC*) ^ ^ABC ABC, ABCDEF, etc.

Searching and replacing with backslashes in the text can be problematic. See: Replace Folder Paths

Use Regular Expressions

In the Find and Replace form, you can choose to use Regular Expressions instead of wildcards. A regular expression is a search string that uses special characters to match patterns of text.

Character Description Find Matches
. Any single character

a.e

ave, ale, ate, etc.

*

Zero or more occurrences of the preceding characters

a*b

b, ab, aaab, etc.

+

One or more occurrences of the preceding characters

a+b

ab, aaab, etc.

?

Zero or one occurrence of the preceding characters

ca?b

cb, cab, etc.

{n}, {n,m}

 

 

A single character can be repeated a specific number of times:

a{n}  Matches 'a' repeated exactly n times

a{n,}  Matches 'a' repeated n or more times

a{n, m}  Matches 'a' repeated between n and m times inclusive

a{2,3}

 

aa, aaa

 

| Matches either of its arguments. Parenthesis can be used: abc|def

ab(d|ef)

abc, def

abd, abef

[]

^

Defines a set or range and matches any members of the set or range:

^ will match any character that is NOT in the specified set or range:

[abc]

[a-d]

[^a-d]

a, b, c

a, b, c, d

e, f, g, etc.

Replace With

Enter the value of the replacement string in Replace With. If the search string includes wildcard characters, you will be prompted to replace all possible matches.

Characters in the Replace With prompt are always case-sensitive. 

Partial string replacement

To replace one or more characters of a string with other characters, use the dollar sign '$' in both the Find What box and the Replace With box:

Find What Replace With Description

$q

$Q The lithology codes for a set of drilling data have been incorrectly specified and occurrences of qURT need to be changed to QURT.
$GLB $GLA_B Tenements with the prefix GLB have become part of tenement GLA and you want to change the prefix accordingly.

Find Next

Use the Find Next button to locate the next and successive occurrences of the value or search string you want to replace. A Replace prompt will be displayed.

Click Yes to replace the current occurrence. If you click No, the search will continue to the next occurrence of the search string.

Click All to replace ALL occurrences of the search string. Click Cancel to abort the operation.

Care should be taken when replacing values. If the results are not what you expect, click the Undo button on the Quick Access toolbar.