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 individual source fields in the advanced Field Assignment Settings. These format settings will only be applied according to the special rules stored for the individual source fields. These formatting rules will only be applied to phone number fields, which you can configure from the Search Wizard.

Phone numbers will normally be converted automatically to an international standard dialing format (+49301234567) according to the rules that you have defined in the Location 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 search and replace feature, which works with regular expressions, will make the modifications. You can check the result of your entry, 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: you will find the caret sign (^) at the top left of the German keyboard.

Here is a brief review of the allowed expressions:

Character Description
^ The beginning of the phone number. The expression, "^0", will find the zero only at the beginning of the phone number.
^ The caret (^) directly after the opening bracket ([) has a special meaning. It is used for excluding subsequent characters between the brackets. The expression, "[^0-8]", will only allow digits between zero and eight.
$ The dollar sign ($) indicates the end of the phone number. The expression, "152$" is only valid for phone numbers that end with 152.
| The pipe sign (|) allows the two characters on either side of it. The expression "8|9" will allow either an eight or a nine.
. The period (.) will allow all characters (or any digit).
* The asterisk (*) indicates that the character to its left must appear zero times or more often.
+ The plus sign (+) operates similar to the asterisk, except that the character to its left must appear at least once.
{<num>} The numeric value inside the bracket shows the number of needed occurrences for the character to its left.
The expression "^([a-e]){3}" is valid for strings, starting with 3 characters 'a' to 'e'.
? The question mark (?) indicates that the character to its left must appear zero times or once.
() Parentheses indicate the expressions that will be available in the replacement field.
[] The brackets ([ and ]) indicate a set of characters that will be permitted at that position.

Replace with

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

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

Notice

With version estos MetaDirectory 4.0.3.5881 the modul for regular expressions has changed.
The operators for replacements "\<num>" and "&" have changed to "$<num>" and $&".

Searches at the end of the input string, like the extraction of the last 3 digits of number +49 30 36856-177 f.E., have to be modified 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 internal numbers having a three-digit extension. ^[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
Add the phone system base number (03012345) to all internal numbers (with one to three digits) ^([0-9][0-9]?[0-9]?)$ +493012345$1
Add the area code to all phone numbers that do not start with zero and have at least four digits (except internal numbers). ^([^0][0-9][0-9][0-9].*) +498151$1

Version MetaDirectory_4.0