Regex to String generation
- by Mifmif
Let's say that we have a regex and an index i , if we suppose that the set of string that match our regex are sorted in a lexicographical order, how could we get the i element of this list ?
Edit : I added this simple example for more explanation :
input :
regex="[a-c]{1,2}";
index=4;
in this case the ordered list of string that matches this regex contains those elements :
a
aa
ab
ac
b
ba
bb
bc
c
ca
cb
cc
output :
the 4th element which is ac
ps: it's known that the string list that match the regex have infinite element, this doesn't have an impact on the proccess of extracting the element in the given index.