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

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

by rsg98, Thursday, August 04, 2005, 12:42 (7050 days ago) @ wodSupport

If you don't eat that one, you will get invalid responses all the time.

Can you try that?

Thanks - that explains it. I added:

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

...to my connection method - and now it behaves itself. I'm also a lot happier because I've gone back to using .Execute, which blocks in the way I'm expecting it to. But, still having problems with the regex side of things. I've tried:

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

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:

http://www.dotnetcoders.com/web/Learning/Regex/RegexTester.aspx

What I need to do is be able to deal with commands that return paged results, e.g.

myprompt-> get mylist
item1
item2
item3
--- more ---

I then read this into a buffer and do something like

[code]
If strBuffer.Endswith( --- more --- ) Then
Do While strBuffer.Endswith( --- more --- )
strBuffer = strBuffer & SshConnection.Execute(vbCrLf)
Loop
End If
[/code]

So when there's no more --- more --- prompts, the loop should exit.

This means that if I set

[code]
.Prompt = --- more ---
[/code]

Then I have a method that works for commands which return paged results. Or I can set

[code]
.Prompt = myprompt->
[/code]

To have a method working for non-paged results.

But not, it seems, both! Any ideas?

Thanks,

Richard


Complete thread: