cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
399
Views
0
Helpful
2
Replies

tcl does not expect regular expressions to work?

Translator
Community Manager
Community Manager

I am trying to use different types of network devices, but I cannot use more complex regular expressions.

For Cisco equipment, I have:

expect {"*>"}

* Functioning normally

But for Fortinet devices, I want to do this

expect {"^[a-zA-Z0-9_.-\s]+[#]"}

But it didn't work. I checked a REGEX "checker" to make sure the expression was correct and that it seemed to work. So basically, I want to filter out the line that starts with "NAME_OF_DEVICE #," because that's what happens when you first connect to Fortinet shell

Do you know why it can't work?

2 Replies 2

balaji.bandi
Hall of Fame
Hall of Fame

If the TCL script not working on fortinet, you need to post this in Fortinet forum for better addressing your issue, how Cisco community can address the issue here ?

look at Fortinet TCL usage :

https://help.fortinet.com/fmgr/50hlp/56/5-6-1/FortiManager_Admin_Guide/1000_Device%20Manager/2400_Scripts/1000_Script%20samples/0400_Tcl%20scripts+.htm

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Nǐ hǎo,

which Regex checker are you using ? Mine is complaining about the '-' character:

expect {"^[a-zA-Z0-9_.-\s]+[#]"}

Can you try the regexp without the hyphen ?

expect {"^[a-zA-Z0-9_.\s]+[#]"}