VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   General (https://forums.vandyke.com/forumdisplay.php?f=11)
-   -   Keyword Highlight (https://forums.vandyke.com/showthread.php?t=14362)

maciekmacku 12-04-2020 06:23 AM

Keyword Highlight
 
Hello,

Is there any option to highlight a word that appears after the specified word? I'm mostly working with Juniper and I would like to highlight zone names that appears after combination "from-zone" and "to-zone" without adding each zone one by one to the Keyword list.

example:

"set security policies from-zone EXAMPLE_1234 to-zone EXAMPLE_4321 policy TEST"

jdev 12-04-2020 11:12 AM

Quote:

Originally Posted by maciekmacku (Post 54409)
Is there any option to highlight a word that appears after the specified word? I'm mostly working with Juniper and I would like to highlight zone names that appears after combination "from-zone" and "to-zone" without adding each zone one by one to the Keyword list.

example:

"set security policies from-zone EXAMPLE_1234 to-zone EXAMPLE_4321 policy TEST"

Yes, with regular expression keyword highlighting with sub-string (spaces in regular expressions) support in SecureCRT version 8.7 or newer, you could use pattern that implement a look-behind strategy. As examples (two separate patterns):
(?<=from-zone )\S+
(?<=to-zone )\S+
Notes:
  • In order to use such patterns (patterns which include spaces), you must first ensure that you open Session Options, navigate to the Terminal / Keyword Highlighting / Advanced category and set the the Match style to be: Phrases and substrings
  • Whatever is between the (?<=[/B] and the closing ) will be looked for as a condition for matching, but not included in the actual match.
  • There is a trailing space character following the word "zone" in each pattern above.
  • The \S+ portion of the expression represents "One or more non-whitespace characters"; in other words, it represents the text you want to be highlighted.
--Jake

maciekmacku 12-10-2020 02:28 AM

thank you Jdev, works like a charm


All times are GMT -6. The time now is 05:27 PM.