develooper Front page | perl.perl5.porters | Postings from January 2018

Re: regrepeat()

Thread Previous | Thread Next
January 18, 2018 15:48
Re: regrepeat()
Message ID:
On Sun, Dec 31, 2017 at 04:21:04PM -0700, Karl Williamson wrote:
> On 12/31/2017 4:13 PM, Andy Lester wrote:
>>> My question is, does this happen often enough in real life to justify the extra code?
>> I'd bet that the case of the object of the + being a single character is the most common use of +, starting with things like s/ +$//;
>> --
>> Andy Lester =>
> Yes, but the issue is in the strings it matches, are there a lot of  
> spaces in a row?  Only in that case is there a noticeable speed up

I think multiple spaces in a row is the most common in practise.

However, I also think most people would not write / +/, but /\s+/
to match a sequence of spaces.

Some questions:

  - What is the effect of this proposed patch if /a+/ is used, and it
    matches just one or two characters (or even fails to match?). 

  - Can it still partially match a string of 'a'? "aaaaa" =~ /a+(?=..)/
    should match just three a's.

  - Is there any effect on modifiers? /a+?/, /a++/


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About