Page 1 of 1
Highlight All with Regex
Posted: Wed Nov 27, 2013 11:40 am
by bitmonger
When using the Highlight All option when searching a document I find it works flawlessly except when the Regex option is checked. Then it works sometimes and not others; often when refresh is hit all matches disappear and then never highlight again until Regex is turned off and refresh is hit again.
I am using Ver 14 SR2 on Windows 7.
Update:
It seems to be related to whether the Case option is selected. (I assume the case option is usually not used when using the Regex option) If it is accidently turned on, the refresh causes de-selection. If it is turned off, a refresh will not regenerate a highlight. The process must be started over.
This is not a big deal and I may be overlooking something.
Any suggestions?
Thanks
Re: Highlight All with Regex
Posted: Wed Nov 27, 2013 4:24 pm
by FileViewer
It seems to be related to whether the Case option is selected
Can you give me some
exact steps to reproduce the problem?
Re: Highlight All with Regex
Posted: Wed Nov 27, 2013 8:51 pm
by bitmonger
Simple example:
Open a view of a text file containing a few 2+ digit numbers and a few words with the letter T
Search for T with Highlight All checked - T is highlighted.
Check the Regex box, hit refresh, T still higlighted
Check Case, hit refresh, highlight gone
Turn off Case, hit refresh, no highlight.
Turn off Regex, hit refresh, highlight on
Now lets try searching for the \d\d (a Regex pattern)
Check the Regex box and hit refresh, all the 2 digit numbers are highlighted
Turn on Case, hit refresh, highlight gone
Turn off Case, hit refresh, highlight still off
Turn off Regex, refresh, nothing, - need this step to clear system it seems
Turn on Regex, hit refresh, all 2 digit numbers highlighted.
Note: I have the Search Bar enabled at the bottom of the window
It seems the Case being on at the same time as Regex causes highlight to turn off, and in the case of the \d\d Regex search, it needs a refresh cycle with no boxes checked before the Regex will work again.
Although technically searching for the T isn't what is normally thought of as a typical Regex pattern, it is still valid using a Regex search.
Hope this helps,
Thanks for your time.
Re: Highlight All with Regex
Posted: Wed Nov 27, 2013 9:59 pm
by FileViewer
Thanks for the example.
I will try to fix the problem in the next service release.
Re: Highlight All with Regex
Posted: Thu Nov 28, 2013 8:21 am
by bitmonger
I think normally when using PCRE the Regex defaults to case sensitive, and if you want it insensitive you have to give it a /i toggle when feeding it the Regex string. However, I notice when searching for the T when using Regex it finds both. I don't know how it's implemented in V. Perhaps have the /i appended to the string when Case isn't selected in a Regex and dropped when it is?
Just a thought, as I don't know the implementation.
Thanks