State of knowledge

March 2023

Regular expressions (RegExp or Regex) are used to search strings for a certain pattern. You can use the regular expressions, for example, to specify functions such as Find/Replace by... or to specify in more detail the application of rules for number formatting, the distinction of internal or external calls, and adjustments for incoming or outgoing calls based on certain criteria. 

Here are some examples and notes on how these rules can be designed in ProCall Enterprise. 

Search for...

This expression is applied to the string. If a match is found, the string is replaced with the expression in Replace with.

Permitted expressions

CharactersDescription
^The beginning of the string. The expression "^0" finds the "0" only at the beginning of the call number.
^The caret 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 string.
The expression "152$" is valid only for numbers ending with "152".
|The pipe allows both characters between which it stands.
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.
?The question mark indicates that the character to its left must be present 0 or 1 times.
()The round bracket marks the expressions available in the Replace with field.
[]The square bracket signals a set of characters that are allowed at this point. 
\The backslash is used as an escape sequence.
If you want to search for a "+", you have to write "\+".

The caret character (^) can be found at the top left of a German keyboard.

Replace with...

If a match was found with the string, the string will be replaced by the expression entered here. Parts of the found string can be inserted here:
\1 outputs the first expression of the Search for field marked by "( )".
\2 the second etc.

Examples

EffectSearch forReplace with
Remove a leading 0.^0(.*)\1
Replacing 80 at the beginning of a number (e.g., targeted trunk access) with 0.^80(.*)0\1
Removing a private PIN number introduced by 50xxx at the beginning of the call number.^50[0-9][0-9][0-9](.*)\1
Suppress all call numbers that are signaled internally (3-digit).^[0-9][0-9][0-9]$
Adding a trunk code (leading 0) for all phone numbers with more than 3 digits.^([0-9][0-9][0-9].+)0\1
Adding the system base number (03012345) to all internal numbers (1 to 3 digits).^([0-9][0-9]?[0-9]?)$03012345\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].*)08151\1 

Examples for incoming and outgoing

EffectSearch forReplace with
Remove a leading 0.^0(.*)\1
Replace 80 at the beginning of a number (e.g. targeted trunk access) with 0.^80(.*)0\1
Removal of a private pin number which is prefixed by 50xxx at the beginning of the phone number.^50[0-9][0-9][0-9](.*)\1
Suppress all call numbers that are signaled internally (3-digit).^[0-9][0-9][0-9]$
Adding a prefix (leading 0) for all phone numbers with more than 3 digits.^([0-9][0-9][0-9].+)0\1
Adding the system base number (03012345) to all internal numbers (1 to 3 digits).^([0-9][0-9]?[0-9]?)$03012345\1
Add 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].*)08151\1 

Examples for PC dialing

EffectSearch forReplace with
Dialing the phone number +49891234567 via a dedicated line with direction code 80,^\+49891234(.*)80\1
Changing the (external) phone number 11833 to 11855.^11833$11855
Changing the (internal) phone number 115 to 215.^115$215 

Examples of internal rules

EffectSearch for
All phone numbers beginning with 9 are internal.^9
All phone numbers that start with 77 and have a maximum of 5 digits are internal.^77[0-9]?[0-9]?[0-9]?$
All phone numbers that start with 77 and have exactly 5 digits are internal.^77[0-9][0-9][0-9]$

Examples of external rules

EffectSearch for
The emergency number 110 is always external.^110$
All phone numbers beginning with 11 are external.^11
All phone numbers that start with 11 and have exactly 5 digits are external.^11[0-9][0-9][0-9]$

Dialing rules for formatting phone numbers for PC dialing

The dialing rules influence the formatting of phone numbers when dialing from the PC.

Sequence

The formatting of the phone number is done in this order:

  1. Formatting
    All characters are removed except + * # 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z. All letters are converted to capital letters.
  2. Vanity number recognition
    If the phone number contains one of the configured vanity prefixes and the letters following it are valid according to the rules of ITU E.161, the phone number is first converted into dialable digits.
  3. More formatting
    All characters are removed except + * # 0 1 2 3 4 5 6 7 8 9.
  4. Recognition of special external phone numbers
    The "External rules" are used to decide whether an external call number is involved. If an external number is detected, it is dialed externally without further formatting.
  5. Recognition of internal phone numbers
    The rules for internal call numbers are used to decide whether this is an internal call number in the system. If an internal number is detected, it is dialed without further formatting.
  6. Unification of the telephone number
    The phone number is now converted to the super canonical phone number format.
  7. Applying least cost routing
    If configured, the rules of least cost routing are applied. When setting call forwarding, least cost routing is not used. (The set call forwarding applies regardless of the time of day and week and is therefore not considered by least cost routing).
  8. Conversion of external call numbers to internal call numbers
    If you have configured a system call number (system connection), the system checks whether the call number is an internal call number. If an internal call number was detected, the call number is shortened.
  9. Applying the "Rules PC dialing"
    The number passes through the special rules for PC dialing.
  10. Conversion to dialable phone number
    The phone number is reformatted into a dialable phone number according to the rules of the configured country. The dialing rules of the countries are stored in a configuration file countries.xml.
  11. Applying the office codes
    The appropriate exchange code number(s) is/are prefixed.
  12. Apply the rules PC dialing final
    Directly before the phone number is sent to the telephone system, these rules are applied.
  13. Dialing the phone number
    The phone number is sent to the telephone system. 

Helpful information

Information on regular expressions can also be found in the UCServer help under F1 or the Documentation online e,g, for ProCall 7 Enterprise or ProCall 8 Enterprise

Weiterführende Artikel