develooper Front page | perl.perl5.porters | Postings from September 2003

Re: optimizing /\s*,\s*/

Thread Previous | Thread Next
From:
Mark Jason Dominus
Date:
September 8, 2003 11:52
Subject:
Re: optimizing /\s*,\s*/
Message ID:
20030908185246.28972.qmail@plover.com

>   @fields = split /\s*,\s*/, $string;
> 
> Could the engine be optimized to search FIRST for the NON-OPTIONAL comma,
> and then match all immediately preceding whitespace?  

Perhaps I misunderstand what you mean, but doesn't it already do this?

        perl -Mre=debug -e '"   ,    " =~ /\s*,\s*/'

        ...
        floating `,' at 0..2147483647 (checking floating) stclass `ANYOF[\11\12\14\15 ,{unicode_all}]' minlen 1 
        ...
        Guessing start of match, REx `\s*,\s*' against `   ,    '...
        Found floating substr `,' at offset 3...
        ...

and then it starts the backtracking search.


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