Regex Clarification and trouble - WeOnlyDo Discussion board

Regex Clarification and trouble (wodSSH / wodSSH.NET)

by Grant Collingwood, Monday, September 06, 2010, 00:53 (4974 days ago)

I am having trouble with a prompt in non-blocking mode with regex using wodSSH.NET.

Most prompts are ok, but in one case I am entering a command with Ssh1.Send(, the expected response will be like:
Are you sure xxxxxx (y/n)

I have tried
Ssh1.Prompt = regex:Are you sure
and
Ssh1.Prompt = regex:(y/n)

and they don't seem to be detected, and are not triggering the PromptReceivedEvent

Can you advise what I should use ?

P.S. Note: I am connected to an SSH server, and then telnet through to a Telnet system, where I am having the trouble.

P.S. Note: I notice in the data received text box, that where I have entered a CRLF, I see ^M in the data, if that helps.

P.S. Note: I cannot give you access to test with, as this is an internal system.

Thanks for your help. Grant

Re: Regex Clarification and trouble

by wodSupport, Monday, September 06, 2010, 01:05 (4974 days ago) @ Grant Collingwood

Grant,

your prompts are not using regular expressions at all. You can try using them without regex: prefix.

Regular expressions can be used to detect much more complicated prompts that are not static, which I believe is not the case in your side. If you decide to use regular expressions, you can check out Wikipedia about its syntax: http://en.wikipedia.org/wiki/Regular_expression

Kind regards,
Kreso

Re: Regex Clarification and trouble

by Grant Collingwood, Monday, September 06, 2010, 01:21 (4974 days ago) @ wodSupport

Thanks for the reply.

But, how can I check for the prompt without regex, when I don't know the xxxxs characters in the middle of the prompt. Ie the prompt will be:
Are you sure xxxxx (y/n)

And xxxxx is always changing.

Re: Regex Clarification and trouble

by woddrazen, Monday, September 06, 2010, 09:09 (4974 days ago) @ Grant Collingwood

Hi Grant,


What happens if you set inside Prompt Property only (y/n)? Does it work like that maybe?


Drazen

Re: Regex Clarification and trouble

by Grant Collingwood, Monday, September 06, 2010, 10:53 (4974 days ago) @ woddrazen

Thanks. Yes, I found that by setting the Prompt to Are you sure without using regex, it actually triggered the promptreceived.

Thanks for your help. Grant.