Home
contactCopy Online Help Prev Page Prev Page
ContactCopy Help
Overview
Confirm parsing result
Settings
Settings: Dynamics CRM
Settings: Text replacement rules
Contact information parser
Report wrong parsing result

Text replacement rules


With text replacement rules, you can modify the original text before it is processed by the contact data parser.

Situations for using text replacement rules:

  • If you want to remove strings from the input text
    Example:
    The text "show on map" is embedded in the textual contact information. Create a rule removing this string, so that the parser does not try to interpret it as a contact item.

  • If you want to standardize the format of contact items
    Example:
    the abbreviation "str." should be replaced by "street"

  • If the parser wrongly identifies strings as contact items
    Example:
    the parser considers the string "recipient" as part of a company name.
    Create a rule that deletes the string "recipient" (i.e. replaces it by an empty string).

  • To help the parser extract contact items, by making them easier to inperpret
    Example:
    There are separating characters between first and last name, preventing the parser from recognizing them as name items.
    Creat a rule that removes these separating characters (replaces them by an empty string).

  • To replace structural elements unknown to the parser by structural elemnts the parser understands. This helps the parser to better understand the input.
    Example:
    There is a structural element "OrigCtry:" (for "country of origin") embedded in your text data
    Create a rule that replaces "OrigCtry:" by "Country:".

  • To add missing or implicit information to the text.
    Example:
    in addresses from a specific source, phone numbers don't have area codes.
    Create a rule that replaces the phone number without area code by the number including the area code.


Each text replacement rule consists of

  • Requirements (optional)
  • Modifications, consisting of
    • Search patterns (strings or regular expressions)
    • Replacements
    • Search options (case sensitive search, whole words only)


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:
  • Source text
  • Source window
  • Source URL (when copying from a web browser)

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).

    search string 1<Tab>replacement string 1
    search string 2<Tab>replacement string 2, etc.

Note: The replacement string is optional. In lines without a Tab character, only the search string will be imported.

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:

If you specify a regular expression as the search pattern, the replacement string can contain replacement variables $1, $2, $3, .... They will be replaced by the 1st, 2nd, 3rd, ... string matching a sub-pattern from the search pattern. Sub-patterns are enclosed in brackets. See Example 3 below.

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"