Phone Number Format

You may enter rules for formatting the phone numbers.

The phone numbers reported to the PC by the telephone system can be modified using rules, in order to adjust them to the TAPI application used.

The phone numbers sent to the PBX by the TAPI application (such as when making a call) can be modified as well.

Each line in the list contains an option if direct text compare or a regular expression is used.

The Search and Replace function uses regular expressions for making the modifications. When a search pattern matches, the result from the replace pattern will be used as output. If the search pattern does not match, the original number will be sent without modifications. The entries will be processed in sequence. If a match is found, the remaining entries will be ignored.

There are three categories:

  • Incoming
    This section is for phone number from incoming calls that are reported from the PBX system to the PC.
  • Outgoing
    This section is for phone number from outgoing calls that are reported from the PBX system to the PC.
  • PC Dialing
    This section is for phone numbers that are dialed on the PC and send to the PBX system

Search for:
Enter the regular expression to be used for finding the phone number.
Hint: The caret (^) symbol is the upper left key on the German keyboard.
An overview of allowed expressions:

Character Description
^ The beginning of the search string (phone number). The expression "^0" matches '0' only at the beginning of the search string.
^ Placing the caret (^) symbol immediately after an opening bracket ([) changes the meaning of the regular expression. "[^" means that the characters between the brackets should not be matched. The expression "[^0-8]" means that the numbers 0 through 8 will not be considered part of the match.
$ The dollar sign ($) will match the end of the string. The expression "152$" will match the sub-string "152" only if it is at the end of the string.
| The alternation character (|) allows either expression on its side to match the target string. The expression "1|2" will match '1' as well as '2'.
. The dot (.) allows any character (or any number).
* The asterisk (*) symbol looks for zero or more occurrences of the indicated character to the left of the current character.
+ The plus (+) sign operates similarly to the asterisk symbol, but looks for at least one matching character.
? The question mark (?) matches the character on the left 0 or 1 times.
() The parenthesis affects the order of pattern evaluation and also serves as a tagged expression that can be used when replacing the matched sub-string with another expression.
[] The corner brackets ([ and ]) indicates the amount of signs that are permitted at this point.

Replace with:
Enter the expression that defines how the number is to be formatted.
\1 represents the first matched expression enclosed by parentheses '( )' from the search pattern field.
\2 the second ...

Check:
You can check your specification immediately. Enter the phone number that you want to test using the search & replace expressions in the Phone Number field. The modified phone number will be displayed in the Output field. If there is an error in the regular expression, it will be displayed there. If the Search expression is not found then the unmodified phone number will be displayed.

Examples:

Result Search for Replace with
Remove a leading 0 from the phone number ^0(.*) \1
Replace a leading 80 at the beginning of the phone number by a 0 ^80(.*) 0\1
Remove a private pin number that may be identified by a 50 followed by a 3 digit pin. ^50[0-9][0-9][0-9](.*) \1
Suppresses all phone numbers that have three digits. ^[0-9][0-9][0-9]$
Add an access code (leading 0) to all numbers with more than 3 digits (e.g. all external numbers). ^([0-9][0-9][0-9].+) 0\1
Add base number (03012345) for the system to all internal numbers (with 1 to 3 digits) ^([0-9][0-9]?[0-9]?)$ 03012345\1
Add your long distance call indicator to all numbers that do not begin with 0 and have at least 4 digits (thus are not internal calls). ^([^0][0-9][0-9][0-9].*) 08151\1

See also location.

Version ECSTA_5