Phone number formatting

You may enter rules for formatting the phone numbers.

The phone numbers that are reported from the PBX system to the PC and the numbers that are sent from the PC to the PBX system may be modified with a Search and Replace function.

The phone numbers that are sent from the Tapi Application to the PBX (make call) may 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. If a search pattern matches, the result from replace with will be used as output. If the search pattern does not match, the original number will be reported unchanged. The entries in the list are processed one after each other. If one match is found the remaining enties will be ignored.

A differentiation is made between categories:

  • Incoming
    Phone numbers for incoming calls which are reported to the PC by the phone system are formatted with these rules.
  • Outgoing
    Numbers for outgoing calls which are reported to the PC by the phone system are formatted with these rules.
  • PC dialling
    This section is for phone numbers that are dialed on the PC and sent to the PBX system

Search for:
Enter the regular expression that will be used to find a phone number.
Hint: The caret (^) can be found on the upper left key of a keyboard with German layout.
A brief overview of the permitted expressions:

Character Description
^ The beginning of the search string (phone number). The expression "^0" matches '0' only at the beginning of the search string.
^ The caret (^) immediately following the left-bracket ([) has a different meaning. It is used to exclude the remaining characters within brackets from matching the target string. The expression "[^0-8]" indicates that the target character should not be 0
$ 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 asterix (*) indicates that the character to the left of the asterix in the expression should match 0 or more times.
+ The plus (+) is similar to an asterix but there should be at least one match of the character to the left of the + sign in the expression.
? The question mark (?) matches the character to its 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 may check your expressions right here by entering a phone number in the indicate field. The resulting output will be displayed. If the expression from the search pattern is not found, the phone number will be send to the outpout without modification.

Examples:

Effect Search for Replace with
Removal of a leading 0 ^0(.*) \1
Replacing a 80 at the beginning of a number (e.g. targeted external dialling code) with 0 ^80(.*) 0\1
Removal of a private PIN which is added to the beginning of a phone number as 50xxx ^50[0-9][0-9][0-9](.*) \1
Suppress all internal numbers having a 3-digit extension. ^[0-9][0-9][0-9]$
Add an external dialling code code (leading 0) for all numbers with more then 3 digits ^([0-9][0-9][0-9].+) 0\1
Add the phone system base number (03012345) to all internal numbers (1 to 3 digits in length) ^([0-9][0-9]?[0-9]?)$ 03012345\1
Adding an area code to all numbers not beginning with 0 and containing at least 4 digits (thus not internal). ^([^0][0-9][0-9][0-9].*) 08151\1

Version 4.0