Re: RegEx matching on WaitFor or Prompt - WeOnlyDo Discussion board

Re: RegEx matching on WaitFor or Prompt (General questions)

by wodSupport, Friday, August 05, 2005, 22:57 (7049 days ago) @ rsg98

[code]
'Clear receive buffer
strBuffer = SshConnection.Receive
Debug.Write( *** Initial Data *** & vbCrLf & strBuffer)
[/code]

This maybe isn't enough. If you connect to really slow device, it may be possible that at a time Receive is called not yet everything arrived. I prefer to use Waitfor(prompt) after calling Connect, just to be sure...

.Prompt = myprompt-> <- Works!
.Prompt = regex:myprompt-> <- Works!
.Prompt = regex:--- more --- |myprompt-> <- No matches!

Sorry, I'm no regex guru :) We just added support for it, I cannot give you advice on what kind of expression to use.

The last one is frustrating - because without being able to do that, I can't use .Execute and I'll get back into the timing mess I was in before. The regex seems to be right according to...

I'd like to point out that Waitfor implementation is just something like this:[code]localbuffer = localbuffer + ssh1.Receive
if instr(localbuffer, 1, your_prompt ) then do something[/code]
As you can see - to implement your own WaitFor that will be smarter and capture your '-----more----' is easy. Why don't you try that?
I can't go deep into behavior of your specific case, this is up to you. I can only offer suggestions on how I would do it.

Hope it helps. Regards.


Complete thread: