Background: I'm developing a custom regex-like syntax for URL filenames. It will work like this:
- User writes a pattern, something like
"[a-z][0-9]{0,2}"
, and passes it as input - It is parsed by the program and translated into the set of permutations it represents i.e.
'a'
,'a0'
,'a00'
...'z99'
These patterns will vary in complexity, basically anything that could appear in a URL filename must be accommodated. The language is either Java or PHP, but examples in any language or abstract/conceptual help is more than welcome.
My questions are:
- Where to start with the implementation of a "parser" for the above
and less importantly,
- How to translate parsed complex patterns into strings programmatically