Replace

On the File tab, in the Edit Data group: Select Fields | Replace to search for and replace specific data in one or more fields of a file.

This option is also available from the File Editor tab in the Search group when a file is open and the Lookup Table Editor tab when a lookup table is open.

Alternatively, you can run Fields | Update, select Replace and click the More button opposite.

When you execute the function, it will search the selected field for the strings you defined, and replace them in the original files with the new strings.

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

You can search for numeric values or character strings and may optionally use wildcards and relative operators. See: Wildcards

Remember, when using wildcards with fields of type CHARACTER, all data (including numbers) will be evaluated as character strings (and numbers come before characters in the program ordering). For example, you can search a field for all values that start with a or b, by entering <=b*.

File

Enter the name of the file you want to work with. Optionally select a filter to selectively control which records will be processed.

Field name

In the column called Field name, type the name of the field that contains the data you want to change.

Replace

In the column called Replace, type the string to search for, using wildcards if required.

With

In the column called With, type the new value to replace the existing string.

Match

Use the drop down to select the whether you want to Match on Any part of a field, the Whole field, or the Start of a field. NOTE: These Match options are redundant if the '$' wildcard is used or if you are using regular expressions.

Match Case

Select the Match Case option to perform a case-sensitive search for results. 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.

Use Regular Expressions

Select the option 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.