Closed myearwood1 closed 5 months ago
Can you attach the form?
From what I can see and what you describe, I don't understand why you think there should be only one match, but then again I can't see the Init.
Silly me. Shoulda asked for your search expression as well. Little chance I would enter exactly.
Silly me for not thinking to provide it too. (?!.*external array laSomeArray).*laSomeArray
I am unable to open your zip file. Can't you just paste in the two files?
It won't allow the scx or sct filetype. Here's a normal zip vs the 7zip I usually use. dummyform.zip
Ah, so the issue here is how RegEx is used.
First of all, GF uses this, which no doubt does not have all the features you might be accustomed to.
Createobject ('VBScript.RegExp')
Second of all, RegEx only find matches on the same line, not across multiple lines. Your negative lookahead spans multiple lines.
Ah. I guess you're doing one line at a time so you can find the lines to show in the grid? So you are editing my regex to suppress multi-line spanning? When it's using grep to find the files, it still finds files that my regex would exclude. Is this multi-line spanning a lack in VBScript.RegExp or is it something you are doing - which you could possibly put a switch in the options to allow it?
Darn. I was hoping to use it as a to-do list of the bugs I need to fix. I could fix a couple and rerun the GoFish until none show up.
I suppose I could use the CustomUDF search feature, at least the fixed files would not show.
Mike --
It's not quite right to say "you" when referring to GF. There is no "you", it's a project whose original designer passed away a few years ago.
GF's design is to show matches in single lines (not statements, but physical lines).
The first attempt to expand this was in GF5, which allowed you to set a filter (after searching) based on code in the same statement or procedure. This filter had wild card matches but not regex matches. In essence, this allowed to fling a wide net with your main search and then narrow it based on the secondary filter.
GF7, released earlier this year, allowed you to wild card (not regex) searching in the same statement. For instance,
Select*Customer
There is no provision now for doing searches across entire procedures (which is what you are looking for).
I am not sure that would work anyway for your example as I don't believe the RegEx used handles negative look ahead. (I suggest clicking the little help button to the right of the combobox where you choose RegEx).
The idea of single line searching is really baked into GF and modifying it to work separately would be a huge lift.
Note that the first pass, using grep, handles the entire file as one, with no knowledge of foxpro procedures (which is why it can be so fast0).
When it's using grep to find the files, it still finds files that my regex would exclude.
All that grep does is to find candidate files, so this is not surprising, if it found other possible matches in the same file.
Hope this helps. No doubt not the end of this discussion.
Hey @myearwood1
You can achieve what you want in a few steps, using the Filter Builder
Search for laSomeArray (I guess this could be a plain search, right).
Right click on the "Match Line" column heading and select the first option:
A little round about, but it delivers what you are looking for.
I suppose. It seems to be that grep is not properly doing the lookahead/lookbehind stuff.
I read that Silver Surfer may be better.
On Wed, Jun 5, 2024, 6:09 p.m. Jimrnelson @.***> wrote:
Hey @myearwood1 https://github.com/myearwood1
You can achieve what you want in a few steps, using the Filter Builder
1.
Search for laSomeArray (I guess this could be a plain search, right). 2.
Right click on the "Match Line" column heading and select the first option:
image.png (view on web) https://github.com/VFPX/GoFish/assets/81179335/60efbd1e-8b31-417d-8a10-9afc501f86aa
- Then use the Filter Builder. Note the use of the leading '!' to exclude matches in the procedure
image.png (view on web) https://github.com/VFPX/GoFish/assets/81179335/23379f66-19b3-4abc-a391-15a49b8fe1da
A little round about, but it delivers what you are looking for.
— Reply to this email directly, view it on GitHub https://github.com/VFPX/GoFish/issues/241#issuecomment-2151041317, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL36W57S45KTGLG3EQTRQ3ZF6EBLAVCNFSM6AAAAABI3IIHWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJRGA2DCMZRG4 . You are receiving this because you were mentioned.Message ID: @.***>
It seems to be that grep is not properly doing the lookahead/lookbehind stuff.
I think you didn't quite see my earlier point. grep.exe (as we are using it) merely finds candidate files for GF to search through.
When searching through those files, GF uses 'VBScript.RegExp'. As explained, this only finds matches in the same line, not across lines.
You can see this by trying your same search expression in GF5 -- searching for regular expressions in GF7 is exactly as it was in GF 5.
I get that. It's unfortunate that's all it does. It would be immensely helpful to walk through a codebase and eliminate the idiotic bugs one at a time. However, I thought I could rely on grep to find the files that still have the bug and let GoFish show those files to me in the way that it does, which is nice. Grep is definitely not working properly. I'll have to send them a bug report.
This regex causes an error in grep - not GoFish's fault, just something to be aware of.
c:\gofish7\grep\grep -PIrl '^(?!.external array wTheLines).wTheLines' --include='*.prg' 'c:/myfolder/' The filename, directory name, or volume label syntax is incorrect.
Grep is definitely not working properly. I'll have to send them a bug report.
I would expect that grep would narrow the file-candidate list to only those files where there is a problem, even if GF thereafter reported all references to the array name, instead of just the problem. Apparently, that is not the case.
Can we close this issue now?
This regex causes an error in grep - not GoFish's fault, just something to be aware of.
c:\gofish7\grep\grep -PIrl '^(?!.*external array wTheLines).wTheLines' --include='.prg' 'c:/myfolder/' The filename, directory name, or volume label syntax is incorrect.
I tried that same code in the command window, different folder name, and did not get an error report.
@myearwood1
I believe that this has been fully addressed. If anything more comes up in the future, please open a new issue.
@Jimrnelson This is so much better to use to search!!!!! Thank you ever so much for helping me get us to this point.
I am trying to get compiler errors to go away, specifically unknown arrays. Grep is finding the file properly. IMO GoFish is showing too many matches.
ℹ Computer information
📝 Provide detailed reproduction steps (if any)
(?!.*external array laSomeArray).*?laSomeArray
✔️ Expected result
Only the button click should show in GoFish. The init is correct.
❌ Actual result
The init and the click show, when only the click should.
📷 Debugging Info
📷 Screenshots