I want to be able to generate a list of all possible matches for a pattern. This will be for phone numbers configured in a sip gateway where the numbers are added into the config as patterns, not individual numbers. I need to generate a list of all the numbers that a given gateway is configured to handle. The ranges are defined in a very simple notation, with "." being a wildcard (matches 0-9), and brackets holding a set and/or range of numbers.
For instance, given something like :
I want to end up with a list like this :
I've gotten to the point where i can get a nice array that has each place and either a digit or an array ref for those that have multiple matches. I just can't figure out a way to output all of the possible matches. I'm hoping there is a module that I can't find that can translate a pattern into a series of all possible matches. I've tried List::Maker, which comes so close it hurts, but still isn't quite what i need and I haven't been able to shoehorn it into what I'm seeking. I can think of a couple of ways to brute force my will onto this problem, I'm just trying to find a more elegant solution. I'm out of good ideas, and running low on bad ones, so I'm hoping someone has some guidance.