(Created target blank page For Version: PSAAS:Public) |
(Update with the copy of version: 8.5.0) |
||
Line 1: | Line 1: | ||
− | <!-- | + | = Examples of Screening Rules= |
+ | |||
+ | This section provides examples of screening rules.<br/> | ||
+ | |||
+ | ==Credit Card Number== | ||
+ | |||
+ | To find text that includes a typical credit card number, you need to match a sequence of four groups of four digits, each group separated by <tt>-</tt>(hyphen):<br/> | ||
+ | <ul><ul> | ||
+ | <tt>\d\d\d\d\-\d\d\d\d\-\d\d\d\d\-\d\d\d\d</tt> | ||
+ | </ul></ul> | ||
+ | <!-- Available styles: (default)-Important, 2-Tip, 3-Warning --> | ||
+ | {{NoteFormat|This regular expression also works without the <tt>\</tt> (backslash) before the hyphens. However, it is better practice to write <tt>\-</tt> for the character hyphen, because the hyphen also has a special use in range expressions like <tt>[a-z].</tt>}} | ||
+ | Or if you want to allow for the possibility that some people will omit the hyphens, use<tt>?</tt> to make the hyphen optional:<br/> | ||
+ | <ul><ul> | ||
+ | <tt>\d\d\d\d\-?\d\d\d\d\-?\d\d\d\d\-?\d\d\d\d</tt> | ||
+ | </ul></ul> | ||
+ | You could also use the repetition notation to shorten each <tt>\d\d\d\d</tt> to <tt>\d{4}.</tt> | ||
+ | <br/> | ||
+ | |||
+ | ==North American Phone Number== | ||
+ | |||
+ | North American phone numbers consists of ten digits, grouped into two groups of three and one of four. There are a number of ways for the groups to be separated:<br/> | ||
+ | <ul><ul> | ||
+ | 203-555-1234 | ||
+ | </ul></ul> | ||
+ | <ul><ul> | ||
+ | (203) 555-1234 | ||
+ | </ul></ul> | ||
+ | <ul><ul> | ||
+ | (203)555-1234 | ||
+ | </ul></ul> | ||
+ | <ul><ul> | ||
+ | 203 555-1234 | ||
+ | </ul></ul> | ||
+ | <ul><ul> | ||
+ | 203.555.1234 | ||
+ | </ul></ul> | ||
+ | The following regular expression matches all of the above:<br/> | ||
+ | <ul><ul> | ||
+ | <tt>(\d\d\d|\(\d\d\d\))[\s\.\-]?\s*\d\d\d[\-\.]\d\d\d\d</tt> | ||
+ | </ul></ul> | ||
+ | |||
+ | |||
+ | The table "Phone Number Regular Expression" analyzes this regular expression.<br/> | ||
+ | {| | ||
+ | |+ | ||
+ | ====Phone Number Regular Expression==== | ||
+ | |- valign="top" | ||
+ | ! rowspan="1" colspan="1" | | ||
+ | Symbols<br/> | ||
+ | ! rowspan="1" colspan="1" | | ||
+ | Meaning<br/> | ||
+ | ! rowspan="1" colspan="1" | | ||
+ | Remarks<br/> | ||
+ | |- valign="top" | ||
+ | | rowspan="1" colspan="1" | | ||
+ | \d\d\d<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | Three digits<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | <br/> | ||
+ | |- valign="top" | ||
+ | | rowspan="1" colspan="1" | | ||
+ | \d\d\d|\(\d\d\d\)<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | Three digits, or three digits enclosed in parentheses<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | <tt> \</tt> turns off the special meaning of the character <tt>(</tt> | ||
+ | <br/> | ||
+ | |- valign="top" | ||
+ | | rowspan="1" colspan="1" | | ||
+ | [\s\.\-]?<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | Space or period or hyphen or zero<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | Any one of the items enclosed in square brackets, either once or not at all<br/> | ||
+ | |- valign="top" | ||
+ | | rowspan="1" colspan="1" | | ||
+ | \s*<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | Zero or more spaces<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | <br/> | ||
+ | |- valign="top" | ||
+ | | rowspan="1" colspan="1" | | ||
+ | \d\d\d<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | Three digits<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | <br/> | ||
+ | |- valign="top" | ||
+ | | rowspan="1" colspan="1" | | ||
+ | [\-\.]<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | Hyphen or period<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | Note again the need to use <tt>\</tt> | ||
+ | <br/> | ||
+ | |- valign="top" | ||
+ | | rowspan="1" colspan="1" | | ||
+ | \d\d\d\d<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | Four digits<br/> | ||
+ | | rowspan="1" colspan="1" | | ||
+ | <br/> | ||
+ | |} | ||
+ | |||
+ | ==Telltale Words== | ||
+ | To screen for interactions from dissatisfied customers, you might try a regular expression like the following:<br/> | ||
+ | <ul><ul> | ||
+ | <tt>(not\s([a-z]+\s)*(pleased | satisfied)) | unhappy | complain</tt> | ||
+ | </ul></ul> | ||
+ | The first part of this expression matches ''not'' followed by zero or more words followed by ''pleased'' or ''satisfied''; for example, ''not'' very pleased, not satisfied, not at all satisfied (but it also matches strings like ''can not believe how pleased I am''). The rest matches the single words "unhappy" and "complain."<br/> | ||
+ | |||
+ | [[Category:V:PSAAS:Public]] |
Revision as of 13:39, August 10, 2017
Contents
Examples of Screening Rules
This section provides examples of screening rules.
Credit Card Number
To find text that includes a typical credit card number, you need to match a sequence of four groups of four digits, each group separated by -(hyphen):
-
\d\d\d\d\-\d\d\d\d\-\d\d\d\d\-\d\d\d\d
Or if you want to allow for the possibility that some people will omit the hyphens, use? to make the hyphen optional:
-
\d\d\d\d\-?\d\d\d\d\-?\d\d\d\d\-?\d\d\d\d
You could also use the repetition notation to shorten each \d\d\d\d to \d{4}.
North American Phone Number
North American phone numbers consists of ten digits, grouped into two groups of three and one of four. There are a number of ways for the groups to be separated:
-
203-555-1234
-
(203) 555-1234
-
(203)555-1234
-
203 555-1234
-
203.555.1234
The following regular expression matches all of the above:
-
(\d\d\d|\(\d\d\d\))[\s\.\-]?\s*\d\d\d[\-\.]\d\d\d\d
The table "Phone Number Regular Expression" analyzes this regular expression.
Symbols |
Meaning |
Remarks |
---|---|---|
\d\d\d |
Three digits |
|
\d\d\d|\(\d\d\d\) |
Three digits, or three digits enclosed in parentheses |
\ turns off the special meaning of the character (
|
[\s\.\-]? |
Space or period or hyphen or zero |
Any one of the items enclosed in square brackets, either once or not at all |
\s* |
Zero or more spaces |
|
\d\d\d |
Three digits |
|
[\-\.] |
Hyphen or period |
Note again the need to use \
|
\d\d\d\d |
Four digits |
|
Telltale Words
To screen for interactions from dissatisfied customers, you might try a regular expression like the following:
-
(not\s([a-z]+\s)*(pleased | satisfied)) | unhappy | complain
The first part of this expression matches not followed by zero or more words followed by pleased or satisfied; for example, not very pleased, not satisfied, not at all satisfied (but it also matches strings like can not believe how pleased I am). The rest matches the single words "unhappy" and "complain."