Regular expressions

Regular expressions are patterns with which strings can be searched. It is thus possible to determine whether the string fulfils specific parameters (length, begins with certain numbers, etc.) or to replace certain parts of the string.

Search for
This expression is used on the string. If a match is found, the string is replaced with the replace with expression.
Hint: The caret (^) key can be found at the upper left of a keyboard with German layout.

A brief overview of the permitted expressions:

Character Description
^ The beginning of the digit chain. The expression "^0" finds "0" only at the beginning of the phone number.
^ The caret directly after the left bracket ([) has another meaning. It is used to exclude the other characters within the bracket. The term "[^0-8]" permits digits from 0 to 8 only.
$ The dollar character labels the end of the character string. The term "152$" is valid for phone numbers which end with "152" only.
| The slash allows both digits each side of it. The expression "8|9" allows "8 or "9".
. The dot (.) permits any character (or any digit).
* The asterisk (*) shows that the characters to its left must be present 0 times or more.
+ The plus sign (+) is similar to the star except that the character to its left must be present at least once.
? The question mark (?) shows that the character to its left must be present 0 or 1 times.
() The round bracket marks the expressions which are available in the replace with field.
[] The square bracket ([ and ]) marks a number of characters which are permitted at this location.

Replace with
Insofar as a match with the string was found, the string is replaced by the expression entered here. Parts of the found string can be inserted here:
\1 reads out the first expression marked with '()' in the search for field.
\2 reads out the second, etc..

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 dialing 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
Suppression of all numbers which are signalled internally (3 digits) ^[0-9][0-9][0-9]$
Add an external dialing 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
Add your own area code to all numbers which do not start with 0 and are at least 4 digits long (and thus not internal numbers). ^([^0][0-9][0-9][0-9].*) 08151\1

Version 8