Read or Write Substitutions (Attribute or Field)

Use this dialog box to configure substitutions in attributes or recordset field strings. Select either the Attribute Properties tab or the Recordset Fields tab and click Advanced in the Read or Write box.

Define the substitution you would like to perform by specifying the string you want to search for and the string you want to use as a replacement. You can include regular expressions to specify your substitutions. For example, to remove trailing blanks from an attribute or recordset, type \s+$ for the string to search for and leave the replacement specification blank.

The list of string substitutions are applied in the order listed in the user interface. By performing multiple replacements, it is possible to isolate words or substrings. Each substitution is equivalent to the Perl regular expression syntax s/<Search for>/<Replace with>/g. The "g" stands for "global", which replaces all matches (not just the first one).

For example, to replace 2 or more blanks with a single space:

Regular expressions in Host Integrator uses the syntax described in How to Use Regular Expressions.

Substitution Examples


Purpose Search For Replace With
Remove leading blanks
(white space at beginning is replaced with an empty string)
Remove trailing blanks \s+$  
Remove all spaces \s  
Remove first word ^[A-Za-z]+\s  
Remove last word [A-Za-z]+$  
Change negative numbers represented with parentheses (123) to be a negative sign -123. \(([0-9]+)\) -$1
Prepend value (at beginning) (^.*$) <value>$1
Append value (at end) (^.*$) $1<value>


Related Topics
Bullet How to Use Regular Expressions
Bullet Adding an attribute to an entity
Bullet Substituting a regular expression for a recordset field