in reply to Multiline Regex

I'm interested in knowing why you want this change.

By the way, it should speed things up to to eliminate impossible starting points.

if ( my ($line) = $str =~ /^(.*?$regex.*)/m ) { print "Matched Line $line\n" }

The .*? on the LHS makes it behave more naturally if you add subcaptures.

Replies are listed 'Best First'.
Re^2: Multiline Regex
by Anonymous Monk on Oct 09, 2008 at 11:01 UTC
    That's the best solution so far as it doesn't resort to splitting or file handles. Although, I was hoping there would be a way I could avoid the use of two .*'s.

      Although, I was hoping there would be a way I could avoid the use of two .*'s.

      Again, I wonder what you have against .*.