Jump to: navigation, search

Functions and Arguments

Functions

Screening rules can use three basic functions:

  • Find(“<text>“), where <text> is a text string. It returns the result true if the interaction contains the exact string between quotes, ignoring case.
  • RegExFind(“<regular expression>“), where <regular expression> is a regular expression (see Regular Expressions ). It returns the result true if the interaction contains any string that matches the regular expression between quotes.
  • RegExMatch(“<regExp>“), where <regular expression> is a regular expression. It returns the result true only if the entire content of the interaction matches the regular expression between quotes.

  • Important
    RegExFind and RegExMatch are the same except that RegExFind looks for a match anywhere in the body of the interaction, whereas RegExMatch demands that the entire body of the interaction match the regular expression.

Arguments

All functions have one required argument, which must appear between double quotation marks, as represented above (<text>) or (<regular expression>). This required argument can be followed by one or two optional arguments, depending on the function. The full form of each function, including all arguments, is as follows:
Find(“<text>“, <IgnoreCase>)
RegExFind(“<regular expression>”,<“key”>,<IgnoreCase>)
RegExMatch(“<regular expression>“,<IgnoreCase)


IgnoreCase

The IgnoreCase argument must be a Boolean value (true or false). All three functions ignore case in searches unless you include the IgnoreCase argument with a value of false.
For example:

  • Find(“pacific“) finds Pacific and pacific.
  • Find(“Pacific“,false) finds Pacific but not pacific.

You can also substitute true for false—for example, Find(“Pacific“,true)—which means that case is ignored. So Find(“Pacific“,true) is the same as Find(“Pacific“).


Key

The key argument must be a string. If this argument is present, the system creates a key-value pair with the following characteristics:

  • The key name is the string specified by the key argument, prefixed by ScrKey_.
  • The value is the material that the screening rule matches.

The system then adds this key-value pair to the interaction’s attached data.
For example, RegExFind(“[A-Z]\d\d\d”,”ID_code”,false):

  1. Finds strings consisting of a capital letter followed by three digits (see Regular Expressions) .
  2. Attaches to the interaction a key-value pair called ScrKey_ID_code whose value is A123, X005, M999, or whatever the function found in this interaction to match the regular expression.
This page was last modified on December 17, 2013, at 11:54.

Feedback

Comment on this article:

blog comments powered by Disqus