|
contactCopy Online Help |
|
|
Text replacement rules
With text replacement rules, you can modify the original text
before it is processed by the contact data
parser.
Each text replacement rule consists of
Requirements If a rule should only be applied when copying information from specific web-sites or applications, you can specify that as a requirement for the rule.Requirements of text replacement rules can use the following information:
Replacements Search patterns can be either strings or regular expressions. Use the buttons Export or Import for exporting or
importing rules from/to a text file. The file format is a text file
with two values per line, separated by a Tab character (ASCII
9). Text replacement rules will be applied in the order in which they appear in the rule list. Use the Move up and Move down buttons to adjust the priority of a rule. Regular expressions In addition to strings, ContactCopy supports regular expressions as search patterns in a text replacement rule.ContactCopy uses regular expressions of the Perl type. See the follwing pages for details on Perl regular expressions:
How to use text replacement rules - Examples Example 1:Original text: CustFaxNo 212 555 5555 Preprocessed text: Fax 212 555 5555 Problem: "CustFaxNo" is used to label fax numbers, but ContactCopy does not recognize the label "CustFaxNo". Solution: Create a rule that replaces the label CustFaxNo with the label Fax, which ContactCopy understands. Example 2: Original text: 11 West 53rd Street, New York NY 10019 (Show address on map) Website: www.moma.org Preprocessed text: 11 West 53rd Street, New York NY 10019 Website: www.moma.org Problem: When selecting contact information in an online address directory, a link named (Show address on map) is included in the selection. ContactCopy should ignore this string, instead of displaying the string as an "unrecognized item." Solution: Create a rule that replaces the string (Show address on map) with an empty string (i.e. removes the string). Example 3: Original text: Phone 555 7890 Preprocessed text: Phone (212) 555 7890 Problem: In an address directory on http://www.abc.com, all phone numbers are specified without area codes. But ContactCopy only recognizes phone numbers with area codes. The area code to insert should be (212). Solution: Insert the area code (212) between the string "Phone" and the phone number. --> Create a rule that replaces the regular expression pattern Phone (\d\d\d) (\d\d\d\d) with Phone (212) $1 $2 Notes: \d matches a digit $1 will be replaced by the string matching the first sub-pattern between brackets, (\d\d\d), $2 will be replaced by the string matching the second sub-pattern between brackets, (\d\d\d\d), etc. Note: To make sure this rule is ONLY applied when copying from http://www.abc.com (as it might produce invalid results when copying from other sites), set the requirement "Source URL contains www.abc.com" |