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

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



On May 25, Randal L. Schwartz said:

>>>>>> "Jeff" == Jeff Pinyan <jeffp@crusoe.net> writes:
>
>>> Or even simpler:
>>> 
>>> $b = '\A$b\z';
>>> 
>>> The regex is /$b/.  It matches only '$b'. :)
>
>Jeff> That fails.  It has to match '\A$b\z'.
>
>No, the regex is "dollar b".  it matches "dollar b" and only "dollar
>b".  It just happens to need a Perl variable called "$b" set to a
>particular value. :)

Perhaps I wasn't clear enough...

  $re = q{^.*(??{$&eq'^.*(??{'.substr($&,7,46).'})\z'?'':'(?!)'})\z};
  $re =~ $re;

See that?  That is what must be done.  The regex must match the text of
the regex itself, and no other text.

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