On Fri, Jul 06, 2007 at 04:48:48PM +0530, Prasad Joshi wrote:
> Hi All,
>
> This is the string I am passing to the expect
> "Do you want to uninstall depot \w+ from \w+ which is dependent"
>
> But, I am not getting why it is failling to match following line which
> is printed on the terminal.
> "Do you want to uninstall depot VRTSvxfs from slpam09 which is dependent"
>
> Basically, If I remove the regular expression strings from the inputed
> string to expect ie. remove \w+ with the exact word, then it is working
> fine. I am not getting what I have done wrong.
>
> Please help.
>
> <<<<<<<<<<<<<<<< PART OF THE CODE <<<<<<<<<
> push (@match_patterns, "Do you want to uninstall depot \w+ from \w+
> which is dependent" ) ;
> $functions[$#functions+1] = \&send_yes ;
>
> my $expect = $cluster->getExpect ($hosts[0]); ##### this
> returns an expect object
> $expect->expect($timeout, '-re', "MyPrompt>");
>
> #### THIS IS A CALL TO EXPECT.
> my ( $matched_pattern_pos, $error, $matched_str, $before_match,
> $after_match) = $expect->expect( $timeout, '-re', @match_patterns ) ;
> <<<<<<<<<<<<<<<<
>
> I am not able to use regular expression in the expect string. Please help.
>
> Thanks and Regards,
> Prasad.
Besides the quoting issue already mentioned, it's not clear from your
code that the '-re' precedes the match pattern you're describing; maybe
you've already pushed some entries into @match_patterns? This may be
different in older versions of Expect, but at least as of v1.15 the
'-re' argument applies only to the next string/pattern argument in the
list.
Ken
--
Ken Irving, fn...@ua...
|