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

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



On May 25, David H. Adler said:

>On Fri, May 25, 2001 at 10:21:38AM -0400, 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.
>
>I notice that you didn't put any further constraints.  How about just a
>literal string?
>
>$regex = 'HEY';
>
>Or did I miss something?

That matches "THEY".  The regex must ONLY MATCH ITSELF.  No other text
should match it.

  ^.*(??{$&eq'^.*(??{'.substr($&,7,46).'})\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