ReplaceInString

Top  Previous  Next

×V4.5Ø

S

A

W

WS

ü

ü

Syntax - Replacing from a file

ReplaceInString <VariableName> FILE <RegExPattern> <ReplacementValue>

 

Syntax - Replacing from a variable

ReplaceInString  <VariableName> <SourceValue> <RegExPattern> <ReplacementValue>

       Where:

               <VariableName> is the user defined name that is assigned to the variable.

       <SourceValue> is a literal string or a variable that contains a literal string.

               <RegExPattern> is a literal string or variable that contains a string.

               <ReplacementValue> is a literal string or variable that contains a string.

Description:

This command is used to find and replace a regular expression pattern specified by <RegExPattern> that is found within a string or variable. If FILE is used instead of a string or variable, the file referenced is the input file and the last line that was read. When a match is found, the match is replaced with a new value defined by <ReplacementValue>. The results of the command are written to the variable specified by <VariableName>.

 

Sample 1:

       The following example looks for any XML tags inside the current line of the input file and replaces any matches with nothing. The result is assigned to the variable called XMLContent. This strips off all XML tags.

ReplaceInString XMLContent FILE "<[^>]+>" ""

 

Sample 2:

       The following example looks for any XML tags inside the variable TransactionStatus and replaces any matches with nothing. The result is assigned to the variable called XMLContent.

ReplaceInString XMLContent TransactionStatus "<[^>]+>" ""