develooper Front page | perl.perl5.porters | Postings from December 2014

Re: All I want for Christmas is: Streaming Regexps

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
December 26, 2014 19:01
Subject:
Re: All I want for Christmas is: Streaming Regexps
Message ID:
20141226190130.04f30bcf@shy.leonerd.org.uk
On Fri, 26 Dec 2014 19:34:58 +0100
Lukas Mai <plokinom@gmail.com> wrote:

> There's also
> 3) $str matches $re but adding more characters may make it fail
> 4) $str matches $re but adding more characters may match more

Ahyes, these are two more useful cases.

> Example:
> 3) $str = "foo"; $re = qr/\bfoo\b/;
> 4) $str = "foo"; $re = qr/\w+/;
> 
> I think what I want to know here is whether regexec() reached EOS in
> any way or not.

I think in summary it might be sufficient for the RE engine to keep
track of the latest character in $str that it needed to look at, with
length()+1 meaning "had to consider EOS". Then you can compare that
high-waterlevel with the length of input, to decide between the cases.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk
http://www.leonerd.org.uk/  |  https://metacpan.org/author/PEVANS

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