Custom Phone Formats for Directory

We have introduced custom phone formatting to the latest version 2.84 of Simple Intranet.  It is found in the Dashboard / Simple Intranet / Directory Options area. This is an alternative to the existing country code format options available.  This option will allow you to customize spacing, and characters such as “+” and brackets for your country’s typical phone formatting.

image (3)

How it works

The first option area uses the PHP preg_match function. You need forward slashes at the beginning and the end. In the example above of /([0-9]{2})([0-9]{4})([0-9]{4})/ the [0-9] looks for digits 0 through 9.  The curly brackets such as {2} means that there will be a grouping of 2 digits, then {4} is a grouping of another 4, then another {4}.

The next field input defines the spacing and special characters you want in your output.  So the $1 is the first grouping of 2 digits, is has a + in front of it, and is wrapped in brackets.  The $2 is the second grouping of 4 digits and the $3 is the last grouping of 4 digits.  You can see the output of the above example inputs below.