Regex to String generation
        Posted  
        
            by 
                Mifmif
            
        on Programmers
        
        See other posts from Programmers
        
            or by Mifmif
        
        
        
        Published on 2014-06-08T15:40:49Z
        Indexed on 
            2014/06/09
            21:39 UTC
        
        
        Read the original article
        Hit count: 332
        
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.
© Programmers or respective owner