in reply to Is there a way to allow consecutive zero-length matches without using pos()?

Can you show an example of "matching consecutive zero-length strings"?

I can easily generate a random string with

my $string = join q(), map +('a' .. 'z')[rand 26], 1 .. 10_000

but I have no idea what regex(es) to try to match to play with it.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Is there a way to allow consecutive zero-length matches without using pos()?
by ambrus (Abbot) on Nov 03, 2017 at 16:24 UTC

      Thanks for the context. Does rubasov's solution not answer this question? In what way does it fail to meet your criteria?

        That solution rewrites the multiple regular expressions to a single big regular expression. That works, but I didn't need it. I never had jsm's performance problem (presumably because I didn't use those perl versions for that very old code), so assigning pos worked just fine for me.