We use cookies on our website to ensure we provide you with the best experience on our website. By using our website, you agree to the use of cookies for analytics and personalized content.This website uses cookies. More Information
It seems like your browser didn't download the required fonts. Please revise your security settings and try again.

Barracuda Phone System

How do I Format Regular Expressions for use with the Barracuda Phone System?

  • Type: Knowledgebase
  • Date changed: 2 years ago

Solution #00004849

Scope:
All Barracuda Phone Systems, all firmware versions.

Answer:

Regular expressions (regexes) use a combination of standard and meta-characters to create a pattern against which to match a specific string. Characters in the regular expression can mean different things depending upon the context. This list will provide a basic starting point for regular expressions used by the Barracuda Phone System.



Common characters Used and their Meaning:

Characters Meaning

1 Match only the digit "1"

5 Match only the digit "5"

411 Match digit sequence "411"

^411 Match string beginning with 411

411$ Match string ending with 411

^411$ Match exact string "411" (see below)

[0-9] Match any digit between 0 and 9

[2-9] Match any digit between 2 and 9

[456] Match either the digit 4, 5, or 6

\d Match any digit between 0 and 9

^ Match at beginning of string

$ Match end of string

+ Match one or more of the preceding character

* Match zero or more of the preceding character

! Negative match forward lookup

{n} Match exactly n of the preceding character

() creates a variable to be used in modifying strings


Executing the String:

In cases were you are passing the characters matched to the provider unchanged, you can end the regex string with a $ to indicate the end of a string. In some scenarios you will want to modify the string, and will need to indicate a modifier. For this scenario, we will want to end the match with $:::, as this indicates we are intending to enter an execute string which modifies the pattern matched. We will also, in this scenario, enclose the string being passed to the modifier in parenthesis to create a variable. Variable numbers are assigned in order from the beginning of the string.


Examples of strings without modifiers:

7 digit dial   - ^\d{7}$

10 digit dial - ^\d{10}$

Emergency - ^911$


Examples of strings that are modified:

7 digit, add 1+ area code 734   - ^(\d{7})$:::1734$1

10 digit, pre-pend 1 to number  - ^\d{10}$:::1$1

10 or 11 digit, send 10 digits     - ^1?(\d{10})$:::$1

10 or 11 digit, but not Toll-Free - ^1?((?!8(00|44|55|66|77|88))[2-9]\d{2})([2-9]\d{6})$:::$1$2




Common Regex Pattens Used:

In this scenario we are removing a dialed 9 and passing the eleven digit number as dialed:


Pattern                               Dialed Digits               Digits Actually Sent Out

^9(\d{11})$:::$1                 918005551212           18005551212


In this scenario we are removing the 9 and the (optional 1) that is dialed and matching a 10 digit number. We then add a 1 to all outbound calls. This creates a uniform rule for 9 and 10, or 11, digit dialing to compensate for possible user error:


Pattern                               Dialed Digits               Digits Actually Sent Out

^9?1?(\d{10})$:::1$1        98005551212             8005551212



In this scenario we are passing an 11 digit number, and appending a + symbol for e164 dialing. It is used with some SIP trunk Providers:

Pattern                               Dialed Digits               Digits Actually Sent Out

^\+?(\d{11})$:::+$1            18005551212             +18005551212


Here is a list of commonly used custom regular expressions:


Pattern                              Dialed Digits               Digits Actually Sent Out

^9(\d{10})$:::$1                98005551212             8005551212

^9(\d{7})$:::$1                  95551212                    5551212

^9?1?(\d{10})$:::1$1       918005551212           18005551212

^9?(\d{7})$:::408$1         95551212                    4085551212

^9?(\d{7})$:::1408$1       95551212                    14085551212

^911$                                911                               911

^\d{7}$                               5551212                      5551212

^5\d{3}$                             5000                             5000


Link to this page:

https://campus.barracuda.com/solution/50160000000IFviAAG