Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > General


Thread Tools Display Modes
Old 04-09-2021, 11:31 AM
SeanL SeanL is offline
Registered User
Join Date: Nov 2020
Posts: 2
Keyword Highlighting - RegEx

Hello all,

I'm using keyword highlight in a shell environment where the prompt is just $

I'm trying to highlight the prompt but only the prompt and not every instance of a $.

In my regex tester I can achieve this by use of ^ and multiline mode flag /m

However SecureCRT seems to not support this as it works in my test but not in SecureCRT.

My RegEx: /^(\$ )/gm
Some sample data to be matched on:

ModuleNotFoundError: No module named 'pynetbox'
$ cat get_IPs.py
#!/usr/bin/env python3

import pynetbox

nb = pynetbox.api(url="https://netbox.testingwebsite.com", token="1234123412341234")

all_prefixes = nb.ipam.prefixes.all()

$ $$$$ $ $

My RegEx tester:

Please let me know if there is a way to specify this, or if we can submit this as a feature request.

Thank you.

I've attached my keyword highlighting file. I prefer to use it with the birds of paradise theme.

It's a bit messy and could use some cleanup, I just randomly added as I went, but for now here you go.
Attached Files
File Type: ini Juniper Devices.ini (1.9 KB, 341 views)

Last edited by SeanL; 04-09-2021 at 03:43 PM. Reason: Add
Reply With Quote
Old 04-09-2021, 04:59 PM
cboyack cboyack is offline
VanDyke Technical Support
Join Date: Apr 2020
Location: Albuquerque, NM
Posts: 132
Hi Sean,

The /gm portion is what's causing a problem here. It's not valid in SecureCRT regular expression syntax. SecureCRT's keyword highlighting support doesn't span multiple lines and there's no such thing as "global" -- only a singular line is evaluated (ever) for matches.

Does "*\$ " work to color your "$" prompt (note that there is a space character after the '$' character) ?

VanDyke Software
Technical Support
(505) 332-5730
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 09:08 PM.