No matching results Documentation Forum
Asterisk Tutorial 12 - Asterisk Regular Expressions

Asterisk Tutorial 12 - Asterisk Regular Expressions

Introducing Asterisk Phone Systems – Regular Asterisk Expressions (Regex)

Today, we expand our worldview!

Last time around we limited the world just one Softphone and on number (8888), but today we demonstrate how to make your Asterisk phone system dialplans a bit cleaner and more professional using Asterisk Expressions and dialplan Patterns.

If you are experienced with regular expressions from other programming languages, you will quickly realise that the expressions used are a specialised set for asterisk, which help you make clearer and easier to understand dialplan patterns.

To use Asterisk expressions, you will always need to write the expression starting with underscore:


This tells your dialplan that a placeholder is in place. In our example, we then used the most common expression X, which represents any number from 0 – 9.

In order to demonstrate how the X placeholder functions, we used the extension


in our first example, which will dial any four digit number. However, should you as can be reasonably expected, need to dial shorter and longer phone numbers (so any number of any length) then a good starting point would be to use the full stop or dot expression.


Using this expression will allow you to repeat the previous expression as many times as required. Next we introduced a zero (0) to our placeholder, as many phone systems require users to dial a zero for the outside line. A common mistake is to use the


expression, as this will not work as the command is effectively saying you can dial as many zero’s as you like.

Another expression to avoid using (unless you really have to) is:


as this will match everything including special asterisk expressions (which we will cover later). Instead, we recommend using:


or like in our demo:


as this will select the outside line and allow users to call numbers of any length.

Just in case you didn’t spot it – Mathias made a mistake when explaining the expressions used by our friends over in the US. He was half right, just got the two a bit muddled up. Anyway, the asterisk expressions Z and N match numbers from 1 – 9 and 2 – 9 respectively.

For more on Asterisk Expressions, please visit

Next time, we will take our dialplans further using Asterisk Variables, where we demonstrate how to store information within the variables.

pascom hosted PBX - start upgrading your business communications today

Final Word

A well-configured business phone system that oozes useful tools, delivers excellent audio quality and intuitive call flows will leave callers with a highly professional impression. The configuration options and application availability and how well they are utilized will have a decisive impact on how professionally you manage your calls and therefore how your customers view your company. The switch to a pascom VoIP phone system solution provides the opportunity to not only upgrade your internal collaboration but also to redefine telephony in your company.

If you would like more information regarding pascom and our Asterisk based Software PBX, please visit our website or give the pascom team a call on +49 991 29691 0 to discuss your requirements and get started within minutes using our free hosted business VoIP phone system edition.

Thousands of companies trust pascom to stay connected

Logo - Amparex pascom Customer reference
Logo - KiKxxL pascom Call Centre Customer reference
Logo - Hotel Weitblick pascom Customer reference
Logo - Wake & Camp pascom Customer reference


Philipp Meixner, CEO
As a communications agency with just under 20 employees, the pascom phone system is perfect for us. The technical concept simply functions, which is what you want. The service is exceptional and always accessible (even if it is rarely needed) and as one of the agency’s business partners, we can only recommend pascom: open, straightforward, pleasant to work with - great. Thank you pascom!

Logo - Amparex pascom Customer reference


Stephan Förderung, CEO
We chose pascom because their phone systems offer a sleek, easy-to-use UC client and administration UI whilst providing us with all the PBX and UC features, control and visibility that we could need from our business communications solution. As a result of our excellent experience, we are happy to recommend pascom phone systems to all our customers.

Logo - KiKxxL pascom Call Centre Customer reference


Lars Hoeger, IT Director
When we make decisions regarding new systems, we want to make sure that we have both reins firmly in our hands. Therefore, it is essential to implement systems which adhere to OpenStandards, allowing us to seamlessly connect and integrate these into our existing systems. In addition, we require reliable suppliers, who are ready to customise their solutions to our requirements, which is why we chose pascom who offer exactly this service and more.

Logo - Hotel Weitblick pascom Customer reference


Kassandra Martin, Deputy Director & Reception Manager
We chose pascom as our telephony solution in part due to the scalability, flexibility and ease of deployment. In addition, the pascom platform functions perfectly with our digital guest directories in our rooms whilst offering the largest range of features at easily the most cost effective price compared to alternative solutions. A further deciding factor was the wide choice of compatible hardware that choosing pascom afforded us.

Logo - Wake & Camp pascom Customer reference

Wake & Camp Ruhlsdorf

Markus Gerlitzki, Managing Director
My team and I pride ourselves on the level of excellent care we provide our guests. However, it can be distracting when the phone is always ringing and we constantly answer the same questions. Thanks to the pascom phone system, we have been able to set up an automated attendant self-service hotline which allows guests to quickly get answers and if required callers can be quickly and efficiently routed to an employee. The system greatly improves customer service with around-the-clock answers around opening times and courses and therefore reduces the strain on employees, ensuring we are free to cater to the needs of our on-site guests.

Back to the top