I don't know of any module which does that - for a very simple reason, the number of possibilites quickly explode to very large numbers.

Let's have a closer look - disregarding any Unicode issues, that would render things immediately impossible - at e.g. this regex /a/. So we are looking for a string that contains the letter 'a'. Let the maxlen be 3, a very short string.

We start out with all possible three letter strings. Every byte of the string can have (in principle) 256 different values. This gives 256**3 = 16,777,216 different strings with 3 bytes each. In turn this eats up at least (in reality it's more) 50,331,648 bytes of memory, that's nearly 50 MB! For a three letter string. Furthermore the amount of strings you will get back is huge as well - and what would you do with them ...

Ok, the problem itself is still interesting but you have to turn it down a bit - then it makes a very nice programming problem:

So go ahead and try to write the little program - and feel free to ask here if you come across some problems.

-- Hofmator


In reply to Re: expanding regexps, question with no answer yet by Hofmator
in thread expanding regexps, question with no answer yet by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.