Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matching question

Status
Not open for further replies.

dod123

Programmer
Dec 13, 2004
20
IL
Hello all;

I am tring to match this expression:

[mcilBA0(tasks)]/acec/tasks>

I tried many posibility and I am not sure how to do it correctly.

Thanks.

 
What are you trying to match it against? We need to know the thing you are looking for, and maybe some sample data records...
 
This is a prompt i recieve from a unix server i am telnting to.
When using the NET:TELNET module i need to enter the prompt
 
What he means is we need some other sample prompts, different ones that match the pattern you're looking for and different ones that don't. You can't match anything without a pattern and you can't get a pattern from a single record. More data, please.

________________________________________
Andrew

I work for a gift card company!
 
I not sure i was understood corectly;
This is an example from the CPAN TELNET moule:

use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("sparky");
$t->login($username, $passwd);
@lines = $t->cmd("who");
print @lines;



the prompt my server request is:
[mcilBA0(tasks)]/acec/tasks> instead of bash$ in the example.

Thanks.
 
Try
Code:
Prompt => '^\[mcilBA0\(tasks)]/acec/tasks>$'
as you need to escape the opening [ and ( in the regex. I don't think you need to escape the closing ones...
 
Sorry, left off the starting and ending slashes
Code:
Prompt => '/^\[mcilBA0\(tasks)]/acec/tasks>$/'
 
You may also have a space after the path in the prompt.
Code:
Prompt => '/^\[mcilBA0\(tasks)]/acec/tasks>\s*$/'


Mike

To err is human,
but to really foul things up -
you require a man Mike.

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top