in reply to Re^2: Regex infinite loop?
in thread Regex infinite loop?
Now, I've made the following change in keeping with your suggestion.
No you didn't. You moved the print statement.
Also, is that really the code you tested with?
while (content =~ m%One(.*?)three(.?)five\s+six(.*?)this%gs) { ^^^^^^^
A function that's called over and over and over? I doubt you'd get the output you got if that was the case. Since you're showing us code that has no relevance to yours, it's hard to help.
If you try again, I'd switch to using the following:
$|=1; while ( print("[", pos($content), "]"), $content =~ m%One(.*?)three(.?)five\s+six(.*?)this%gs ) { $var1 = $1 ; $var2 = $2 ; $var3 = $3 ; print "$var1\t$var2\t$var3\n" ; }
But an educated guess on what I've seen leads me to think it's not a problem with your loop.
|
|---|