develooper Front page | perl.perl5.porters | Postings from August 2012

Re: [perl #54702] Feature: regexp modifier to disable interpolationlike m''

Thread Previous | Thread Next
From:
demerphq
Date:
August 23, 2012 13:05
Subject:
Re: [perl #54702] Feature: regexp modifier to disable interpolationlike m''
Message ID:
CANgJU+V7_+NHrxCjJx6Ww7AiycN8Y9ptWRVZ8_3RoTgym0KMpw@mail.gmail.com
On 23 August 2012 21:26, Ed Avis <eda@waniasset.com> wrote:
>>What I normally do is $foo = "hairy $string with ^lots^ and *lots* of metachars."; s/\Q$foo//.
>>
>>Why isn’t \Q sufficient for your purposes?
>
> That works.  I suppose one would want the /o modifier to get the same efficiency as a literal regexp.
> I wanted to also make the general point that while Perl's regexp syntax is convenient for many tasks, sometimes the programmer
> wants more explicit control over when a regexp is parsed to bytecode and when it is matched.  For that a regexp library as found
> in Python or Java can make for clearer and more explicit code - even though it is more clunky for the common case.

What does Python or Java provide that qr// does not?

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About