From: Austin S. <te...@of...> - 2007-08-01 04:55:33
|
On Tue, Jul 31, 2007 at 08:02:21PM -0300, Bruno Negrao wrote: > Hello all, > > Can you tell me why isn't the expect(1, '-re', $string) bellow matching > successfully? > You are putting in a bizarre regular expression and then expecting perl to have it match itself. That doesn't make any sense, let alone work. Maybe you don't want the string to be treated as a regular expression? Austin > I put in color RED the debug message showing that the pattern in $string is > exactly what expect has on it's accumulator. > > So why isn't it matching? There are some "\n" in the pattern, can it be a > problem? > > > Starting EXPECT pattern matching... > Expect::expect('Expect=GLOB(0x8064a020)',0,'-re',' PID TTY > TIME CMD\x{a} 9724 ? 00:00:00 bash\x{a} 988...') called at > /home/brunonz/Net-SSH-Expect/lib/Net/SSH/Expect.pm line 239 > Net::SSH::Expect::eat('Net::SSH::Expect=ARRAY(0x80173ce0)',' PID > TTY TIME CMD\x{a} 9724 ? 00:00:00 bash\x{a} 988...') called > at /home/brunonz/Net-SSH-Expect/lib/Net/SSH/Expect.pm line 270 > Net::SSH::Expect::readAll('Net::SSH::Expect=ARRAY(0x80173ce0)',1) > called at /home/brunonz/Net-SSH-Expect/lib/Net/SSH/Expect.pm line 289 > Net::SSH::Expect::exec('Net::SSH::Expect=ARRAY(0x80173ce0)','ps',1) > called at ./wshell line 66 > eval {...} called at ./wshell line 65 > spawn id(3): list of patterns: > #1: -re ` PID TTY TIME CMD\n 9724 ? 00:00:00 bash\n 9888 > ? 00:00:00 bash\n12978 ? 00:00:00 bash\n13075 ? > 00:00:00 ps\n' > > > spawn id(3): Does ` PID TTY TIME CMD\n 9724 ? 00:00:00 > bash\n 9888 ? 00:00:00 bash\n12978 ? 00:00:00 bash\n13075 > ? 00:00:00 ps\n' > > match: > pattern #1: -re ` PID TTY TIME CMD\n 9724 ? 00:00:00 > bash\n 9888 ? 00:00:00 bash\n12978 ? 00:00:00 bash\n13075 > ? 00:00:00 ps\n'? No. > > > > > Best regards, > > bruno > > > !DSPAM:46afbdd5314191222944467! > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > !DSPAM:46afbdd5314191222944467! > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > > !DSPAM:46afbdd5314191222944467! |