Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Secure Shell

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 05-19-2021, 10:54 AM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
Highlight Keyword with Regex Positive Look Ahead

I'm trying to highlight the sequence "site=name&" without including the "&" in the highlight.

In regex, I can use the following query and it works, but in SecureCRT highlighting it does not.
site=.*?(?=\&))
Does SecureCRT support this?

If I use "site=.*?\&", the whole sequence is highlighted including the "&".

I'm using SecureCRT Version 8.2.0 (x64 build 1402)
Reply With Quote
  #2  
Old 05-19-2021, 12:25 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,633
Hi WesR,

I think you have one too many closing parens.

This works for me in v9.0.1:
site=.*?(?=\&)

This does not:
site=.*?(?=\&))

If you think the double close parens is correct, please post the text you are testing against.

As a note, v8.2 was not even an official release but it's very old. You might check your upgrade eligibility.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 05-19-2021, 12:52 PM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
Thanks and sorry, not sure how that extra Paren made it in there, but it is in the post only.

It still does not work for me in 8.2.
Reply With Quote
  #4  
Old 05-19-2021, 01:59 PM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
Here is an example of the type of string I'm testing against:

enterprise=enterprise1&site=TestSite1&area=Area1&line=Line1&

In this case,

Quote:
site=.*?(?=\&)
doesn't highlight anything.

I can see what I can do with upgrading, but because this was a corporate purchase done for me, I don't know what it might take.

Wes
Reply With Quote
  #5  
Old 05-19-2021, 02:13 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,633
Hi Wes,

Keyword highlighting/regex has been enhanced since v8.2. The first version in which this will work is v8.7.

Changes in SecureCRT 8.7 (Beta 1) -- November 20, 2019
------------------------------------------------------
New features:

  • Keyword highlighting supports the ability to match phrases and substrings and works with literal strings and regular expressions.

What did you find when you checked upgrade eligibility? What is the most recent version your license provides access to? (Please do not post the serial number here, if unsure, please send email to support@vandyke.com and we can check for you.)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730

Last edited by bgagnon; 05-19-2021 at 02:17 PM.
Reply With Quote
  #6  
Old 05-19-2021, 02:18 PM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
I was able to upgrade to 8.3.4 (x64 build 1699), but unfortunately get the same results.

Wes
Reply With Quote
  #7  
Old 05-19-2021, 02:20 PM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
Just saw your post. I don't think I can get to 8.7 or higher easily.

Thanks
Reply With Quote
  #8  
Old 06-03-2021, 04:01 PM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
hmmm well I was able to purchase a license for 9.0.2 , but I get the same results.

Quote:
site=.*?(?=\&)
does not work.

Using the following does, but includes the &.

Quote:
site=.*?\&
As can be seen in the attachment.
The string I am testing against is:
enterprise=enterprise1&site=TestSite1&area=Area1&line=Line1&
Thanks
Attached Images
File Type: png SecureCRT.png (1.5 KB, 343 views)

Last edited by jdev; 06-03-2021 at 04:15 PM. Reason: Embed graphic for easier viewing.
Reply With Quote
  #9  
Old 06-03-2021, 04:28 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,633
Hi Wes,

And, as before, it does highlight the correct characters for me.

That is the text you expect to be highlighted, correct?

Are you sure the version is 9.0?

Please embed a graphic showing the same category in your Session Options configuration.

If that might expose sensitive info, send an email to support@vandyke.com and reference Attn Brenda - Forum Thread #14533 in the subject line (and attach the screenshot).
Attached Images
File Type: png KW_highlight_regex_forum14533.png (28.3 KB, 374 views)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #10  
Old 06-03-2021, 04:33 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,633
Hi WesR,

By the way, a colleague just informed me a look-ahead is not even necessary for what you are trying to accomplish.

If you use this pattern, you should also get the desired results:

Code:
  site=[^\&]+
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #11  
Old 06-03-2021, 06:04 PM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
Ha! Thanks. That workaround without lookaround does work!

I am still curious why the other query is not working. Attached are a some screenshots. I didn't escape the & in the first one. It seems to work either way including with your workaround.

I was just about to click send when I thought... Hey, my List has a lot of things being highlighted. I created a new list with just the
Quote:
site=.*?(?=\&)
Regex in it and it works!

I also checked in my old 8.3 version and the workaround works with that version as well.
Attached Images
File Type: png SecureCRT_wo_look.png (30.0 KB, 150 views)
File Type: png SecureCRT_with_look.png (31.2 KB, 173 views)
File Type: png SecureCRT_version.png (20.8 KB, 171 views)
Reply With Quote
  #12  
Old 06-03-2021, 06:57 PM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
Ok, so I copied my LogErrors.ini file to a new file and restarted.

I then started deleting things. First all the Regex entries and then the other entries. I am left with only the one Regex entry and it still doesn't work. I now have a test file with one entry that works and the LogErrorsCopy with one entry that doesn't. Both only 'show' the one entry.

Test:
Quote:
D:"Match Case"=00000000
D:"Regex Line Mode"=00000001
Z:"Keyword List V2"=00000001
"site=.*?(?=\&)",0080ff80,00000001
LogErrorsCopy:
Quote:
S:"Keyword List"=denied eofexception err error Exception fail failure forbidden warn
D:"Match Case"=00000000
D:"Regex Line Mode"=00000000
Z:"Keyword List V2"=00000001
"site=.*?(?=\&)",0020ff42,00000001
What is this Keyword list and why doesn't it appear in the GUI?

Removing the Keyword List line and reloading SecureCRT showed no change.
Changing the Regex Line Mode to 1 did allow it to work.

This seems to equate to the Advanced/Match style setting which is new. Setting this to Phrases and substrings allowed this to work with all the highlighting rules I have tried. Yeah!

Wes
Reply With Quote
  #13  
Old 06-04-2021, 08:17 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,633
Hi WesR,
Quote:
Hey, my List has a lot of things being highlighted. I created a new list with just the ...
So it was likely a case of "precedence" (order). There was a match based on a regex higher in the list before it reached the one you really wanted it to match on.

I am glad you have resolved the issue.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #14  
Old 06-04-2021, 08:47 AM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
This was not a case of Precedence or Order.

I attempted to convey that I changed it until there was a single entry and it still failed.

It was due to the new (to me and my old version) Keyword Highlighting/Advanced setting set to Whole words. Once I set this to Phrases and Substrings, it worked with my whole list as well as the single list.

Do you know what the
Quote:
S:"Keyword List"=denied eofexception err error Exception fail failure forbidden warn
is and why it is not displayed in the GUI?

Is this just an old item that is no longer supported or something?
Reply With Quote
  #15  
Old 06-04-2021, 09:04 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,633
Hi WesR,

My apologies if I missed something. You have posted a lot of info in a short period of time.

I do not know why that string is in the Keyword List name field. Manually editing keyword list INI files is very much discouraged as the format may change from version to version. Are you sure the correct format was retained in the file after your edits?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730

Last edited by bgagnon; 06-04-2021 at 09:37 AM. Reason: Clarification
Reply With Quote
Reply

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 12:35 AM.