In Re: Expect question I gave some example code that might help you out. I'll repeat the relevant portion here.
print $expect_instance "$username}\r"; ( $which, $why, $match, $before, $after) = $expect_instance->expect( $ +timeout, 'Password:'); if( ! $which ) { myerror( 'send the password:'.$why );
$before is what came before the match, $match is what it matched on (useful if you passed in more than one match candidate), and $after is what came after the match. Note that $before and $after are strings and they may contain newlines..If you want to do multiple matches then I think just replace 'Password' with e.g. @possible_matches in the example code.
I get the impression you are trying to do things beyond the scope of Expect.pm. You should focus on improving the accuracy of your matches and then performing string operations and/or regexes on $before, $after, and $match if appropriate.
If you are still having issues then could you post some sample input/output that shows the problem and what code you are using.
In reply to Re: Need a solution to Expect.pm 's single line regex matching limitation
by Argel
in thread Need a solution to Expect.pm 's single line regex matching limitation
by deepblue
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |