regex
- i use regex mostly for keyword highlighting in securecrt, and advanced search (and replace)
- Windows text files use
\r\n to terminate lines, while Unix uses \n
- regex engine is eager - the order of the alternatives matters
- this is my current config (as of 25/10/2026):
Z:"Keyword List V3"=0000000c
"^[^:\s<\"']+>",00008000,0000000d,0000001f
"(^[^#\s\(\)]+\s?#{1})|(^[\[\w\-@\s~\]]+\$)|(^PS\s(\\|:|\w)+>)",00ff0000,0000000d,0000001f
"^[\w\-\(\)\s\.]+\s#|^\[root[\w\-@\s~]+\]#",008000ff,0000000d,0000001f
"\ba(?:-|uto(?:matically)?)\b|\b(?:no)?negotiat(?:e|ion)\b",00ff0080,0000000d,0000001f
"\b\^C\b|\bcannot\b|\bclosed?\b|\bcollisions?\b|\bcrc\b|\bcriticals?\b|\bdead\b|\bdelet(?:e(?:s|d)?|ing)\b|\bden(?:y|ie(?:s|d))\b|\bdisabl(?:e(?:s|d)?|ing)\b|\bdisconnect(?:s|ed|ing)?\b|\bdrop(?:s|p(?:ed|ing))?\b|\berrors?\b|\bfail(?:s|ed|ing|ures?)?\b|\bfalse\b|\bincorrect(?:ly)?\b|\binvalid\b|\blos(?:e|s|t)?\b|\bno(?:t(?:hing)?|ne)?\b|\bremov(?:e(?:s|d)?|ing)\b|\b(?:shut)?down\b|\bterminat(?:e(?:s)?|ing)\b|\bwarnings?\b",000000ff,0000000d,0000001f
"\badmin(?:istrat(:?or(?:s)?|ively))?\b|\ball\b|\balways\b|\bdefaults?\b|\bhalf\b|\bmtu\b",000080ff,0000000d,0000001f
"\baccept(?:s|ed|ing|ance)?\b|\balive\b|\ballow(?:s|ed|ing)?\b|\bauthenticat(?:ed|es|ing)\b|\b(?:re)?connect(?:s|ed|ing)\b|\bcorrect(?:ly)?\b|\benable(?:s|d|ing)?\b|\bfull\b|\bopen(?:s|ed|ing)?\b|\bpermit(?:s|ted)?\b|\brun(?:ning)?\b|\bsucce(?:ed(?:ed)?|ss(?:es|ful(?:ly)?)?)\b|\btrue\b|\bvalid\b|\byes\b|\bup\b",0000ff00,0000000d,0000001f
"\breset\b|\btimeouts?\b|\bunassigned\b|\bunknown\b|\bunset\b|\bunsupported\b",00808080,0000000d,0000001f
"\bdomains?\b|\bhostname\b|\bversions?\b|\b802\.1q\b|\b(?:\w+ethernet|\w+channel|loopback|fa|gi|eth|lo|po|rj|vlan)\d+(?:/\d+(?:/\d+)?)?\b",00808000,0000000d,0000001f
"(?:[0-9]{1,3}\.){3}[0-9]{1,3}|[0-9a-f]{4}\.[0-9a-f]{4}\.[0-9a-f]{4}|(?:[0-9a-f]{2}:){5}[0-9a-f]{2}",00ff00ff,0000000d,0000001f
"\d{4}-\d{2}-\d{2}|(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d+\s\d{2}:\d{2}:\d{2}\s(?:(?:CET|CEST)\s)?\d{4}|\d{2}:\d{2}(?::\d{2}(?:\.\d{3,})?)?\s",00ffff00,0000000d,0000001f
"\d+(\.\d+(\.\d+)?)?",0000ffff,0000000d,0000001f
D:"Match Case"=00000000
D:"Regex Line Mode"=00000001
S:"List Name"=prod
i use Phrases and substrings instead of Whole words; while Whole words would simplify the regexes by removing \bs, it doesnt allow me to match prompts; plus, Phrases and substrings are more like real regexes, more flexible / superset of Whole words