[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] japhy had a silly idea...



>>>>> "Ilmari" == Ilmari Karonen <iltzu@sci.fi> writes:

Ilmari> 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.

Ilmari> What are the constraints?  If embedding Perl code is allowed, I'd say
Ilmari> the problem essentially reduces to constructing a quine.

Ilmari> (No, I don't have the time to attempt a solution just now..)

Or even simpler:

$b = '\A$b\z';

The regex is /$b/.  It matches only '$b'. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe