Coloring of syntax in SSH sessions

Hi Adam,

you first need to go to the “Plugin” page in the properties and change the active plugin to “Rebex”. After that you need to re-open the bulk-edit dialog. Let me know if this helps.

Regards,
Stefan

how do I create Regular Expressions in order make case insensitive syntax coloring?

The ‘i’ flag in regex matches all cases.

For instance;

(?i)down

Matches DOWN, Down and down (or DoWn if your devices are weird…)

Here are the ones I have setup currently that work for me:

Matches IP addresses

\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b

#55FFFF

#000000

Matches any case of the word ‘down’

(?i)down

#FFFF55

#000000

Matches any case of a word that starts with vlan. (vlan, VLANS, etc.)

(?i)vlan(\w+)|vlan

#5555FF

#000000

Matches any case of a word that starts with fail. (fail, Failure, etc.)

(?i)fail(\w+)|fail

#FF5555

#000000

Matches any case of a word that starts with warn. (warn, WARNING, etc.)

(?i)warn(\w+)|warn

#FFC000

#000000

I should clarify; when you pipe a word that’s an or.

So strictly speaking in the last three I put up there the pattern before the pipe matches anything with starting with the word that has something else after it, and after the pipe it matches the word itself.

I’m sure there’s a more elegant way to do it but I’m not an expert in regex…

Thank you, Adam.

I tried all of the syntaxes in:
https://stackoverflow.com/questions/9655164/regex-ignore-case-sensitivity
I also tried to use regexr.com for creating the syntaxes but none of them worked.

Also, is there a better way of doing:
(?i)err(\w+)|err|(?i)disable(\w+)|disable|(?i)fail(\w+)|fail

I think you can take out all but the first (?i) if you use that as a single string.

Something like:

(?i)err(\w+)|err|disable(\w+)|disable|fail(\w+)|fail

Definitely not more elegant, but a bit shorter and should be functional? I would need to test it out.

Actually, I think this might be better:

(?i)disable(\w*)|fail(\w*)

This should cover all iterations with the words in them. I’m struggling with ‘err’ though.

(?im)^err(\w*)

This should cover everything that begins with “err” case insensitive. However, it isn’t working in RTS for me.

You could use:

(?i)err(\w*)

or have a single line:

(?i)disable(\w*)|fail(\w*)|err(\w*)

But this will catch anything with err in the string.

It will catch “err”, “error” but will also catch “overruns” because it has “err” in it. So it will catch anything with “err” anywhere in the word.

Not sure how Royal implemented regex, but I haven’t been able to figure out how to do start string matches yet.

Alright, I got a new one…it’s more complected but also includes more options. I grabbed the major sytax from another vendor, but it seems to work with RTS:

(¨( *)?no | down |[^A-Za-z0-9](disabl(\w*)|fault|shutdown|disconnected|err(\w*)|ERR(\w*)|fail(\w*)|denied|not permitted|disallowed|not allowed|refused|problem|not permitted|notconnect)[^A-Za-z0-9])

You can take out or add anything between the first set of parentheses after the “[^A-Za-z0-9]”.

The first “| down |” only matches the string “down” with a space before and after. You can exclude that entirely if you want.

that’s great Adam!

Thank you very much, it’s been a long time since I learned and used RegEx.

This isn’t working in my RTS:

(¨( *)?no | down |[^A-Za-z0-9](disabl(\w*)|fault|shutdown|disconnected|err(\w*)|ERR(\w*)|fail(\w*)|denied|not permitted|disallowed|not allowed|refused|problem|not permitted|notconnect)[^A-Za-z0-9])

I’m not using the latest version though, could that be an issue?

Could be? I’m using 5.0.11009 and it is working for me. Is there a specific word that isn’t working?

I’m happy to report that Royal TS 5.0 has been released and includes this feature.

For more information about the major new features of Royal TS 5.0, please head over to our https://www.royalapplications.com/ts/win/features-upgrade

“It will catch “err”, “error” but will also catch “overruns” because it has “err” in it. So it will catch anything with “err” anywhere in the word.”
As |^err(\w*) is not working - you can add space before err and then it will not highlight overruns ie.

(?i)disable(\w*)|fail(\w*)| err(\w*)

try add \b before word: \b(?i)disable(\w*)|\bfail(\w*)|\berr(\w*)

image

you are looking for:

image

hope this help :wink:

Filip

Since I came to RoyalTS from using Mobaxterm, I was spoiled by its syntax highlighting of words that were built-in. Does anyone have a similar regex and is willing to share, to apply this to RoyalTS?

I regularly import a new site with 40+ telnet or SSH sessions via a spreadsheet, is there a simple way to apply syntax highlighting on all these new connections? At present it looks like I have to go add the regex, then select the colours. Can be done in Bulk edit, but its still laborious.

Hi James,

check out the bulk-edit KB here:

I hope this helps.

Regards,
Stefan

Hi James, try to use sikulix.com It can automate any clicking :wink: Filip

one more thing: I expect you can change the default setting for your connection so all new connections will have your requirements. hope this help