Invalid extension

I need help in catching the extension which is not a valid one and if a user dials it accidentally, he is prompted that the extension is an invalid one. right now i m using the standard ‘i’ extension, which works good but only for single digit and it works with background application. what if i want more digit extension, lets say 3,4,5 and moreover the number of digits is not fixed. it can be two, three, four or five. i want to catch the extension and play the invalid file to caller.

shall i use the pattern matching i.e. _. to catch the invalid extension? will it perform as intended and not cause a problem to the valid extensions?

i is not limited to single digit cases.