From: <RGi...@a1...> - 2002-03-15 09:22:40
|
> > > pattern #1: -re `^cs3mc-lab-e0a(\\(\S+\))?#'? No. > > ^^ ^ > > Hmm, this is interesting. Two backslashes in one spot, one > > in the next. Looks like a glitch in Perl to me. And the "\012" is also fishy. What system is the user running on? > It's a regexp to match the Cisco router prompt, which is of the form: > > "Router#" or "Router(config-nacl-ext)#" or "Router(otherjunk)#" > > So I want to match "Router(any junk between parens or no parens at > all)#". I'd try to fiddle with the regexp: qr"\b$routername(?:\(\S+\))?#" should work as well, or qr"$routername(?:\(\S+\))?#\Z". > And it works for me, and since the user says it matches the > first three times when he runs the script, I can't see how > anything could be wrong with it. Oh, maybe the regexp engine has problems... maybe not. > > > However, the big difference between the early commands > > > that matched and the one that failed is that the latter > produces hundreds > > > of lines of output, while the successful commands produced > either 30-40 > > > lines (the "show term") or none at all (the two "set term" > commands) except > > > for the router's prompt. Have you set $exp->match_max? Normally the accum doesn't get truncated, maybe the regexp engine has problems when matching large amounts of data (though I cannot imagine why this wouldn't be detected earlier). > Could there be a race condition in Expect.pm such that if the data > arrives just before or after the timeout, it might end up in the > accumulator (or at least in the debug output of the accumulator) > after the operation timed out? Nope, definitely not. If something is read, it definitely gets checked before the timeout can hit. Hope this helps, Roland -- RGi...@cp... |