Off on another flight of fancy (almost a meditation, but there is a question):
My thoughts went back to Re: Finding string for patterns, and it struck me that maybe there was a Quantum::Superpositions solution that was, if not fast, at least elegantly simple. Of course, the docs of Q::S don't say anything about using regexen, but that doesn't mean it won't Do The Right Thing if you ask it, does it? It's a Damian Conway module, fer cryin' out loud!

I will spare you the pain seeing my first clueless stab at it. Suffice to say, Perl thought. And it thought. It thought so long that I was a little worried it would come back with "42". And then it crashed. Apparently regexen can destroy the universe. Thank God it's only a model.

After more trial and error, I find that the thinking and crashing syndrome occurs when I try to get the eigenstates of a relatively large disjunction. I finally got sensible behavior with

#!perl -l use strict; use warnings; my $MIN_NUMBER = 4; my $MAX_NUMBER = 30; my $string = q(5973821902497150366459738219024971503664); sub match { index($string, $_[0]) >= 0 ? $_[0] : undef } use Quantum::Superpositions UNARY => ['main::match']; my $squares = any(map {$_ * $_} $MIN_NUMBER..$MAX_NUMBER); my $superhits = match($squares); print for eigenstates($superhits);
My question is: is there any way to do super-regexen and super-matching?

Caution: Contents may have been coded under pressure.

In reply to Quantum::Superpositions regex match by Roy Johnson

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.