I gave
a talk about this amongst other things at YAPC::Europe::2004. This question started at slide 20.
I would want "abcdef" =~ m/..*..*./g to return 20 = 6 choose 3 matches.
Hmmm... that's not quite the same
thing I was talking about. How is Perl to know that .* is different from . ?
As far as my solution (actually largely due to abigail) is concerned /..*..*../ is simply /.{4,}/ and all matches thereof in "abcdef" would be 6..
- substr("abcdef",0,4)
- substr("abcdef",0,5)
- substr("abcdef",0,6)
- substr("abcdef",1,4)
- substr("abcdef",1,5)
- substr("abcdef",2,4)
Update: changed
/.*/ to
/.{4,}/ and made resulting changes.