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

Re: [perl #119095] Empty regular expression does not match in some cases

Thread Previous | Thread Next
From:
demerphq
Date:
August 1, 2013 11:09
Subject:
Re: [perl #119095] Empty regular expression does not match in some cases
Message ID:
CANgJU+VNYCjx3q+8oym8X7Am3gK=aTJpZGF3jZTzgG+8u45-CQ@mail.gmail.com
On 1 August 2013 13:08, demerphq <demerphq@gmail.com> wrote:
> On 1 August 2013 13:03, demerphq <demerphq@gmail.com> wrote:
>> On 1 August 2013 12:38, Ed Avis <eda@waniasset.com> wrote:
>>> Out of interest is there a performance boost from reapplying the last
>>> successfully matched regexp using // or is it just a golfing shortcut?
>>
>> Hypothetically a tiny boost.
>
> I should add that its a feature that has extremely limit utility.
>
> As far as I can tell it is only useful in a case like this:
>
> if (/pat1/ || /pat2/ || /pat3/) {
>    s//$something/; # change whatever we matched
> }
>
> Or similar constructs. It actually makes no sense that it applies to
> m//, to the extent it should exist at all it should apply only to
> s///.

IMO we should nuke it and replace it with a (*LASTMATCH) metapattern.

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