Re: [pcre-dev] pcre help required

Kezdőlap
Üzenet törlése
Szerző: Philip Hazel
Dátum:  
Címzett: Aakash Jain
CC: pcre-dev
Tárgy: Re: [pcre-dev] pcre help required
On Thu, 16 Apr 2009, Aakash Jain wrote:

> If you can tell me one thing that would be very helpful for me.
> I want to know that "is there any function in pcre distribution that can
> generate random strings from regular expression(pcre) which are satisfied by
> regular expression ?"


No, there isn't.

> If it is not there, then can we use pcre_compile function to generate
> strings ?


You can't use that function. It might be possible to use the compiled
code (as described, briefly, in HACKING) as data for a new function that
did this, but I am not sure if it is actually possible - I am worried
about the recursion in particular. It is an interesting thought,
however. I guess what you need is something that scans the compiled
regex and, at each branch point, takes a random decision and generates
something that matches. There would have to be some limit on how it
dealt with unlimited repeats, of course.

Philip

--
Philip Hazel