Question: We have the demo [here](http://angular-ui.github.io/ui-utils/#/mask) on the angular-ui page.

Wondering how we can write a mask with optional extension number.

`(999) 999-9999 ext. 999` will make the extension required.

Answer: 
I shared this same problem with you. There is a completely undocumented optional character feature for this component. I could only find it by reading the source code.

The solution for your mask would be: 

```
(999) 999-9999 ext. ?9?9?9

```

Question marks in your mask will flag the next character as optional. Trust me, it works.

Sorry for taking so long to answer.
A good solution for this problem is to use [ngMask](https://github.com/candreoliveira/ngMask) which allows you to do exactly what you want without jQuery. To do that just add an '?' after the character you want to be optional:

`mask="9?9999-9999`

This is great for inputs like Brazilian phone numbers, which can have both 8 or 9 characters.