Regular expressions
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
Characters | Description |
---|---|
^ | 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
Effect | Search for | Replace 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
Effect | Search for | Replace 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
Effect | Search for | Replace 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
Effect | Search 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
Effect | Search 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:
- 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. - 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. - More formatting
All characters are removed except + * # 0 1 2 3 4 5 6 7 8 9. - 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. - 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. - Unification of the telephone number
The phone number is now converted to the super canonical phone number format. - 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). - 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. - Applying the "Rules PC dialing"
The number passes through the special rules for PC dialing. - 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. - Applying the office codes
The appropriate exchange code number(s) is/are prefixed. - Apply the rules PC dialing final
Directly before the phone number is sent to the telephone system, these rules are applied. - 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
-
Seite:
-
Seite:
-
Seite:
-
Seite:
-
Seite:
-
Seite:
-
Seite:
-
Seite:
-
Seite:
-
Seite: