On May 25, Ilmari Karonen said: >On Fri, 25 May 2001, Jeff Pinyan wrote: >> I tried for an hour and a half or so to craft a regex that matches itself, >> and ONLY itself. >> >> I came up with nothing -- well, several dead ends at least. > >What are the constraints? If embedding Perl code is allowed, I'd say >the problem essentially reduces to constructing a quine. > >(No, I don't have the time to attempt a solution just now..) Indeed, I did solve it, using (??{ ... }). Once I realized I could use that, it was trivial. 123456789_123456789_123456789_123456789_1234567 = 47 ^.*(??{$&ne'^.*(??{'.substr($&,7,-4).'})\z'})\z -- Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/ Acacia Fraternity, Rensselaer Chapter. Brother #734 ** I need a publisher for my book "Learning Perl's Regular Expressions" ** ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe