in reply to Re: (tye)Re: Matching inconsistency in for loop
in thread Matching inconsistency in for loop

if( $answer =~ /\Q$questions[$i]\E(.*?)\Q$questions[$j]\E/s ) { print qq(The answer is $1\n); }
/m controls whether ^ and $ can match around newlines in the middle of the string. You want /s which controls whether . can match newlines.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re2: Matching inconsistency in for loop
by Rich36 (Chaplain) on Dec 13, 2001 at 02:41 UTC
    You sir, are truly a saint. I've been tearing my hair out over that for some time. I've obviously got some learning to do when it comes to regular expressions.
    This problem is work related, but what I plan on doing is to reformat the code and set up a Snippet on extracting questions and answers from text.
    Thanks.
    Rich36
    There's more than one way to screw it up...