Replace

Top  Previous  Next

The Replace section determines what you want to do with the data found in the Search section. This section is defined as follows:

 

<Replace>

 <Section>

         (All), Recipient, Sender, Message

 </Section>

 <Type>

         (Literal), RegEx, And, Or

 </Type>

 <Scope>

         (Match), Section

 </Scope>

 <All>

         True, (False)

 </All>

 <Text>

         replacement text goes here

         must be quoted to retain beginning and/or ending whitespace

 </Text>

</Replace>

 

 

Flag

Values and Description

Section

Values: All, Recipient, Sender, Message, Temp, Flag

 

This tag determines which section the filter perform the replacement within.

Value

Explanation

All

All tells the filter to replace any instance of the searched text within the entire data set read from the input file.

Recipient

Recipient tells the filter to replace values only in the first line of the file.

Sender

Sender tells the filter to replace values only in the second line of the file.

Message

Message tells the filter to replace values only in the third and following lines of the file.

Temp

Temp is a string variable that can be passed strings of characters to hold, then use its value to search on later. Temp does not support boolean operators. For example, you can have certain information stored in the Temp value, then both search on and output that Temp value in successive Filter tags.

Flag

Flag is a boolean value that can only hold a true or false statement. However, you can run "And" or "Or" statements against it for advanced logic chains.

 

Type

Values: Literal, RegEx, And, Or

 

This tag determines whether you want to use literal text or a RegEx statement in the Text tag. This tag can also be used as a situational boolean operator to determine how to proceed.

 

The boolean values (Or & And) modify the Flag value. So, for example, you could have the filter search for a value and set it as the Flag, then have the replace filter use "Or" to indicate that the Flag value may be more than one thing. You could also use the And operator to tell the filter that the Flag value must contain multiple variables to be matched. See Example 1 and Example 3.

Scope

Values: Match or Section

All

Values: True or False

Text (Literal)

If the Type tag is set to Literal, this tells the filter to search on the text entered in to the Text tag. For example, you could enter the literal text Fire Department if you wanted the filter to key off of the literal text "Fire Department" (without the quotes).

 

This tag supports the following boolean parameters:

* - Multiple Character Wildcard

For example, fire* would find fire, firewood, fireplace, fireman and similar.

 

? - Single Character Wildcard

For example, fire? would fine fires, fired but would not find fire.

 

~ as first character means start of section/file

~ as last character means end of section/file

For example, ~12345~ would only read 12345. Without the ~ before and after the string, the filter would recognize 12345 in 0123456.

 

Text (Regex)

The PageGate Filter script supports RegEx expressions. RegEx uses a Pearl compatible implementation syntax and a good reference guide for the language can be found here: http://www.regular-expressions.info/tutorialcnt.html

 

As an important note, due to the way this script is programmed, certain characters are treated as command characters instead of literal text characters. The following characters represent certain command functions in the script:

Character

Function

~

~ as first character means start of section/file, ~ as last character means end of section/file. For example, ~123~ would only find 123 and not 01234 or 1237, etc. ~123 would find 12340 but would not find 01234. 123~ would find 0123 but would not find 01234.

?

Single character wildcard.

*

Multiple character wildcard.

\

IMPORTANT

ASCII value prefix (Ex: \013 for a carriage return, \010 for a line feed). The \ must be followed by a three digit code to indicate the character to be output.

 

This character is used when you want to represent a character as represented by its ASCII Decimal value. For example, since the filter directly references the character ~ in its function, if you want to use the ~ character in your text, you'll need to represent it with its ascii value. The ascii value of ~ is \126.