in reply to Need a solution to Expect.pm 's single line regex matching limitation

Hi DeepBlue,

I'm not sure I understand what is the problem exactly. I mean your explanation is coherent but when I use expect to handle a SFTP session, this line:

#$sftp->expect(5, 'sftp>') || die("Never got sftp prompt on $targetSer +ver, ".$sftp->exp_error()."\n");
Is waiting for the SFTP prompt and then I send the upload command and then I do:
#$sftp->expect(120, 'sftp>') || die("Never got sftp prompt on $targetS +erver after upload, ".$stfp->exp_error()."\n");
to capture the end for the transmission. Whatever else gets printed is ignored and my second line only intercepts the new SFTP prompt which is pretty much single(last) line match from all the output the upload session generates. The reason is say I don't understand your problem is that I didn't do anything special for this. I simply ignore everything until I find what I expect (don;t have to ignore explicitly, just look for that you know prompts you for input).

If your regular expression you use matches some of the intermediary blurb spit out before your get prompted for input again, maybe you can change your regexp. If you have access to the install script and can modify it, maybe you can mark your prompt lines with a distinctive patters that'll help you write a regexp that won't give you false intermediary positives.

I think the bottom line is you don't ignore explicitly just match what you're looking for and try to eliminate false positives.

Hope this helps (or I totally didn't understand your problem :) )