Regular Expressions

You can store regular expressions in two places during replication, in order format your source fields complexly. Global rules can be stored for formatting phone numbers in addition to adjusting in the extended field mapping settings. This formatting is carried out according to the special rules stored for the individual source fields. These formatting rules are only applied to phone number fields that you can configure in the Search Assistant.

Phone numbers are normally automatically converted to a supercanonical format (+49301234567) according to the rules you defined in the site settings.

To the extent that there are no phone numbers in your database, which can be formatted, you can use regular expressions to specify the formatting rules.

The modification is done by search and replace, which works with regular expressions. You can check the result of your input by entering a phone number in the "Phone number from database" field. The result from the regular expression will be displayed in the Result field. If the phone number does not match the search expression, the automatic formatting rule will be applied during replication. If a phone is formatted using a regular expression, the automatic formatting will not be used any longer.

Search for
Enter a regular expression according to which the phone number will be sought.
Tip: The caret character "^" can be found in the upper left corner of the German keyboard.

Here is a brief review of the allowed expressions:

Character Description
^ The beginning of the phone numbers. The expression "^0" finds the "0" only at the beginning of the phone number.
^ The caret "^" directly after the left bracket "[" is used to exclude the other characters inside the bracket. The expression "[^0-8]" allows only digits from 0 to 8.
$ The dollar sign "$" indicates the end of the phone number. The expression "152$" is only valid for phone numbers that end with "152".
| The character "|" allows both characters between which it is placed. The expression "8|9" allows "8" or "9".
. The dot "." allows any character (or digit).
* The asterisk "*") indicates that the character to the left of it must be present 0 times or more.
+ The plus "+" indicates that the character to the left of it must be present at least once.
{<num>} The numerical value in the parenthesis indicates how often the character to the left of it must be present.
The expression "^([a-e]){3}" is valid for strings starting with 3 characters from 'a' to 'e'.
? The question mark "?" indicates that the character to the left of it must be present 0 or 1 times.
() The round bracket marks the expressions available in the "Replace with" field.
[] The square bracket "[ and ]" signals the number of characters allowed at this position.

Replace with

Enter the expression which should format the phone number for output.

Character Description
$1 acts as a placeholder for the first expression indicated by "()" for the "Search For" field.
$2 acts as the second placeholder, and so forth.
$& acts as a placeholder for the whole input value.

Instruction

With version estos MetaDirectory 4.0.3.5881 the modul for regular expressions has changed.
The replacement operators "\<num>" and "&" are now represented by "$<num>" and $&".

Searches at the end of the input such as extraction of the last 3 digits of phone number +49 30 36856-177 must be changed as follows:

before
search ([0-9][0-9][0-9])$ replace: $1 (resp. \1)

now
search (.+)([0-9][0-9][0-9])$ replace: $2

Examples

Effect Search for Replace with
Suppress all call numbers that are signaled internally (3-digit) ^[0-9][0-9][0-9]$
Add a country code for all phone numbers with more than three digits. ^([0-9][0-9][0-9].+) +49$1
Adding the system base number (03012345) to all internal call numbers (1 to 3 digits) ^([0-9][0-9]?[0-9]?)$ +493012345$1
Adding your own area code to all phone numbers that do not start with a 0 and have at least 4 digits (not internal) ^([^0][0-9][0-9][0-9].*) +498151$1

Version 6