SSH syntax highlighting: support regular expressions

Implemented

SSH syntax highlighting: support regular expressions

0 vote

avatar

That would be great if we could input some regex for the keyword of syntax highlighting entries:

All Comments (31)

avatar

Hello,
I'm not sure if I it's possible but I will add this to our todo.

Regards

David Hervieux

avatar

Thanks! :)

avatar

Are there any available files for import? For instance a file for Cisco CLI devices. One that has already defined the keywords.

avatar

Not to my knowledge, but if you create one, I'd be keen to test it!

avatar

Syntax highlighting would be an awesome feature. We currently have a Cisco keyword file that was built around SecureCRT and uses regular expressions.


It would be nice to have similar functionality with regular expressions to easily match dynamic output, such as IP Addresses, MAC addresses and interfaces.

avatar



Thanks for chiming in, that's exactly why I requested this feature.

avatar

Just FYI, I wouldn't be very hopeful for this feature.
I asked this same thing of SecureCRT before we purchased RDM.

Their rationale is that in order to support regular expressions in the outputs, the program (RDM) must first parse the entire output so it can run the expressions against, then present it to the user. This is incredibly resource intensive to try and do real-time.
It would almost certainly slow down command outputs to the point you would notice and think the interface is 'slow' or 'unresponsive'.

avatar












I am not sure when you switched to RDM, but I have seen secureCRT support syntax highlighting for years. In fact it was originally released back in 2009 on SecureCRT 6.5.

avatar

I'm not talking about syntax highlighting the word 'down' as the color red.
I'm talking about regular expressions to distinguish 'down' from 'administratively down' as a phrase.
Or a regular expression to identify a MAC address as xxxx.xxxx.xxxx or xx:xx:xx:xx:xx:xx and highlight it accordingly.

Syntax highlighting, and supporting regular expressions are 2 different things.

avatar

Yes, SecureCRT has support regular expressions to match syntax highlighting for years. Specifically to your example, I have in a keyword file the following two strings to match mac addresses.


"(?:[a-f0-9]{2}[:-]){5}[a-f0-9]{2}",00408000,00000001
"[a-f0-9]{4}\.[a-f0-9]{4}\.[a-f0-9]{4}",00408000,00000001

I have attached my old keyword file with all of the various regular expressions to do the syntax highlighting. I think you can load the keyword file in a demo of SecureCRT for testing.

Cisco Words.ini

avatar

interesting. good to know.
Have you noticed the command outputs to be slower then without regex syntax highlighting?
When you do a show run, are the pauses between pressing space bar noticeable while securecrt chew through the outputs?

avatar




Recent text editors / IDE are already doing this at a much larger scale (opening files of thousands/millions of lines with syntax highlighting). Parsing one line and checking against a regex to apply some syntax highlighting isn't going to kill the performances if the code is done right. Plus, I doubt your terminal is outputting thousands of lines per second.

avatar









There is no noticeable impact to the output of show run, even if you set the terminal length to 0, it outputs just as fast with regex syntax highlighting. If there were thousands of lines per second being outputted then I could see the reasoning behind not performing syntax highlighting because of a performance impact.

avatar












So I remember now what Van Dyke said was the performance hit.
Regular expressions with spaces. SecureCRT does not support regex with spaces. So you can't do 'admin down' as a single entry.

avatar








any updates?

avatar

Nothing new for now. It's not even planned for RDM 14.

Regards

David Hervieux

avatar

Is there anyway to highlight IP addresses through the Syntax Highlighting? I agree it would be great to have Syntax Highlighting support expressions.

avatar



Unfortunately no.

avatar

any progress on this?

avatar

Hello,

We're still working on it but we've had other priorities come up for the terminal. We'll be investing more time into this feature, so hopefully we can have something working soon.

Regards,

Hubert Mireault

avatar

Hello,

We've made the change internally. This is planned for RDM 14.1.3.0. You will be able to set an option on each of your syntax highlighting entry if you want it to match by regex or regular matching. This means you can match both if you desire.
Please let us know what you think about the feature once it's available.

Regards,

Hubert Mireault

avatar

Great news Hubert! I'm eager to test that and highlight all my IP addresses. :)

Thanks a lot for implementing this.

avatar

Hi Hubert,


Thanks for the update and working hard to bring features to the product.

What is the normal update schedule? Could we expect this in a month or 2 or sooner?

avatar

Hello,

We're planning to release 14.1.2.0 next week. For version 14.1.3.0 which will contain the feature, we're planning to release it in 2-3 weeks.

Regards,

Hubert Mireault

avatar

Thanks Hubert :)

avatar

Thanks that would be awesome. Also please have a add-on to import all global syntax highlight words.

avatar




You mean like the already existing Import/Export functions?

avatar

Hi,
ready to try this.
Has somebody already done the heavy lifting and can provide us with an export for full Cisco CLI coloring?
Thanks!
Wim

avatar

Hi Hubert,

Is this coming to RDM Free?

avatar

Hello,

Yes, this is also going to be available in RDM Free. :)

Regards,

Hubert Mireault

avatar

This is my take on SSH highlighting to support Cisco IOS: highlights MAC, IP and all sorts of interfaces.
Works great, but ready to be improved / extended, so please comment!


<?xml version="1.0"?>
<SyntaxHighlightingItemList>
<Items>
<SyntaxHighlightingItem>
<BackgroundColor>Black</BackgroundColor>
<ForegroundColor>WhiteBold</ForegroundColor>
<ID>96e501ca-b698-444b-915d-84a0973f2f55</ID>
<IsCompleteWord>false</IsCompleteWord>
<IsRegex>true</IsRegex>
<Keyword>([a-f0-9]{4}\.[a-f0-9]{4}\.[a-f0-9]{4}|[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2})</Keyword>
<Name>MAC</Name>
<SortOrder>0</SortOrder>
</SyntaxHighlightingItem>
<SyntaxHighlightingItem>
<BackgroundColor>Black</BackgroundColor>
<ForegroundColor>WhiteBold</ForegroundColor>
<ID>6db30298-54c2-47ff-8ab0-121b57581881</ID>
<IsCompleteWord>false</IsCompleteWord>
<IsRegex>true</IsRegex>
<Keyword>\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b</Keyword>
<Name>IP</Name>
<SortOrder>1</SortOrder>
</SyntaxHighlightingItem>
<SyntaxHighlightingItem>
<BackgroundColor>Black</BackgroundColor>
<ForegroundColor>Yellow</ForegroundColor>
<ID>f8694d1c-3f38-4541-bc22-9047caf17021</ID>
<IsCompleteWord>false</IsCompleteWord>
<IsRegex>true</IsRegex>
<Keyword>(Interface\s)?(Fa)([^\s]+)</Keyword>
<Name>FastEthernet</Name>
<SortOrder>2</SortOrder>
</SyntaxHighlightingItem>
<SyntaxHighlightingItem>
<BackgroundColor>Black</BackgroundColor>
<ForegroundColor>Yellow</ForegroundColor>
<ID>4524937d-b6ff-4a26-a650-50ff8383a1f4</ID>
<IsCompleteWord>false</IsCompleteWord>
<IsRegex>true</IsRegex>
<Keyword>(Interface\s)?(Gi)([^\s]+)</Keyword>
<Name>GigabitEthernet</Name>
<SortOrder>3</SortOrder>
</SyntaxHighlightingItem>
<SyntaxHighlightingItem>
<BackgroundColor>Black</BackgroundColor>
<ForegroundColor>Yellow</ForegroundColor>
<ID>5ad0ebed-4b38-4487-8672-504871af215b</ID>
<IsCompleteWord>false</IsCompleteWord>
<IsRegex>true</IsRegex>
<Keyword>(Interface\s)?(Te)([^\s]+)</Keyword>
<Name>TenGigabitEthernet</Name>
<SortOrder>4</SortOrder>
</SyntaxHighlightingItem>
<SyntaxHighlightingItem>
<BackgroundColor>Black</BackgroundColor>
<ForegroundColor>Yellow</ForegroundColor>
<ID>997c2bec-d0f7-4c65-ad9b-d8b5bfc29731</ID>
<IsCompleteWord>false</IsCompleteWord>
<IsRegex>true</IsRegex>
<Keyword>(Interface\s)?(Eth)([^\s]+)</Keyword>
<Name>Ethernet</Name>
<SortOrder>5</SortOrder>
</SyntaxHighlightingItem>
<SyntaxHighlightingItem>
<BackgroundColor>Black</BackgroundColor>
<ForegroundColor>Yellow</ForegroundColor>
<ID>34d343f6-81d6-453a-bed9-12e2b7b6e935</ID>
<IsCompleteWord>false</IsCompleteWord>
<IsRegex>true</IsRegex>
<Keyword>(Interface\s)?Vlan\d+</Keyword>
<Name>Vlan</Name>
<SortOrder>6</SortOrder>
</SyntaxHighlightingItem>
<SyntaxHighlightingItem>
<BackgroundColor>Black</BackgroundColor>
<ForegroundColor>Yellow</ForegroundColor>
<ID>8360bc57-0956-4b3f-963d-ee30eb795416</ID>
<IsCompleteWord>false</IsCompleteWord>
<IsRegex>true</IsRegex>
<Keyword>(interface port-channel\d+)?(Po\d+)?</Keyword>
<Name>Portchannel</Name>
<SortOrder>7</SortOrder>
</SyntaxHighlightingItem>
</Items>
</SyntaxHighlightingItemList>