The Complete Filter Script Template

Top  Previous  Next

Note: The InputFile and OutputFile sections are not required for most scripts. For more information, please see The Filter Script.

 

<InputFile>

 <Name>

         (Parameter), static input filename

 </Name>

 <Delete>

         True, (False)

 </Delete>

</InputFile>

<OutputFile>

 <Name>

         (InputFile), static output filename

 </Name>

</OutputFile>

<Debug>

 True, (False)

</Debug>

<Filter>*

 <Search>*

         <Type>

                 (Literal), RegEx

         </Type>

         <Section>

                 (All), Recipient, Sender, Message, Temp, Flag

         </Section>

         <Text>*

                 search text, True, False

                 must be quoted to retain beginning and/or ending whitespace

         </Text>

 </Search>

 <Replace>*

         <Type>

                 (Literal), RegEx, And, Or

         </Type>

         <Section>

                 (All), Recipient, Sender, Message, Temp, Flag

         </Section>

         <Scope>

                 (Match), Section

         </Scope>

         <All>

                 True, (False)

         </All>

         <Text>*

                 replacement text, True, False

                 must be quoted to retain beginning and/or ending whitespace

         </Text>

 </Replace>

 <Continue>

         (True), False

 </Continue>

 <Abort>

         True, (False)

 </Abort>

</Filter>

<Filter>...

 

 

Notes:

 Sections with * are required

 Remove all *'s from a live filter.

 

 Values in () are default values if section is not present

 

 The first Command Line parameter is the name of the InputFile to be processed

 If an <InputFile><Name> section is used, its value overrides the Command Line parameter value

 

 The default settings file name is pgfilter.xml

 The settings file name can be set by using settingsfile= as the first parameter on

 the Command Line. The input file name would then be the second parameter

 

 OutputFile Name supports variables:

         %InputFilePathAndName%

         %InputFilePath%

         %InputFileName%

         %InputFileNameBase%

         %InputFileNameExtension%

 

 Section values for Recipient, Sender, Message, and All really just mean:

         Recipient: first line of text,

         Sender: second line of text,

         Message: third and remaining lines of text

         All: the entire contents of the file

 

 Literal search text special characters:

         ~ as first character means start of section/file

         ~ as last character means end of section/file

         ? matches a single character

         * matches anything (including nothing)

         \ following 3 digits are a decimal character value

         the ~, ?, *, and \ characters must use \ with decimal equivalent to be used literally

 

 RegEx replacement:

         Backreferences are allowed in replacement text

         If the replacement scope is not 'match' or the replacement section is not the same

         as the search section, then only the literal replacement type can be used,

         because RegEx can only make replacements in the original searched text (the

         %Match% and %Group% macros can still be used in the literal replacement text)

 

 Literal search text variables

         %Recipient% - the current value for Recipient

         %Sender% - the current value for Sender

         %Message% - the current value for Message

         %All% - the current value for All of the text

         %Temp% - the current value for the Temp variable

         \ following 3 digits are a decimal character value

 

 Literal replacement text variables:

         %Match% - the actual text that matched the search text (Literal or RegEx match types)

         %Group1%, %Group2%, %Group3% - RegEx group backreferences obtained from a RegEx search

         %Recipient% - the current value for Recipient

         %Sender% - the current value for Sender

         %Message% - the current value for Message

         %All% - the current value for All of the text

         %Temp% - the current value for the Temp variable

         \ following 3 digits are a decimal character value

 

 The default value of the Temp variable is an empty string

 The default value of the Flag variable is false

 

 

 RegEx uses a Pearl compatible implementation syntax

 good reference: http://www.regular-expressions.info/tutorialcnt.html