|
#1
|
|||
|
|||
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() print(all_prefixes)$ $ $ $ $ $ $ $ $$$$ $ $ My RegEx tester: https://regex101.com/r/JjAbtc/1 Please let me know if there is a way to specify this, or if we can submit this as a feature request. Thank you. Edit: 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. Last edited by SeanL; 04-09-2021 at 03:43 PM. Reason: Add |
#2
|
|||
|
|||
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) ?
__________________
Thanks, --Cameron VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
![]() |
Thread Tools | |
Display Modes | |
|
|