VFPX / GoFish

GoFish is an advanced code search tool for fast searching and replacing of Visual FoxPro source code.
8 stars 7 forks source link

Regex reporting many files? #269

Closed myearwood1 closed 2 months ago

myearwood1 commented 3 months ago

ℹ Computer information

📝 Provide detailed reproduction steps (if any)

  1. … I entered a regex ^((?:REPO|REPORT)\s+FORM|CJREPORT).?*invoice\$ and told GF to regex scan. It shows 17,934 files. I restricted it to SCA VCA FRA LBA MNA PRG. It still shows that many files.
  2. … It is searching really slowly, far more than 60 seconds and did not mention Grep.
  3. …Perhaps there should be a way to switch between scanning original sources and textualized sources
  4. However, I tried repo*invoice with wildcard searches and the same restricted set of files and it finished in 34 seconds.
  5. After that, trying the original regex from above took 22 seconds. Something's fishy.

✔️ Expected result

What is the expected result of the above steps?

Blink fast searches

❌ Actual result

What is the actual result of the above steps?

Really slow searches. I had not tried such a search in a while, nor have I tried a more recent version of GF.

📷 Debugging Info

Please add screenshots of

📷 Screenshots

Are there any other useful screenshots? WinKey+Shift+S and then just paste them directly into the form slowwwww

Jimrnelson commented 3 months ago

@myearwood1

Not sure what is going on yet as I cannot reproduce your regex search expression. I see this:

image

My guess is that when you paste it in here some of the special characters get translated.

myearwood1 commented 3 months ago

^((?:REPO|REPORT)\s+FORM|CJREPORT).*?\*invoice\*$

myearwood1 commented 3 months ago

I thought of another way... *repo*invoice and use wildcard. I have never released a utility for developers to use like GF. I mean MaxFrame was a framework over the development. I think I'd have made GF an EXE, because then in VFP9 you could include an internal and or external config.fpw and get more control over GFs environment.

Jimrnelson commented 2 months ago

@myearwood1

I thought of another way... *repo*invoice and use wildcard.

Yes, my normal mode is to use wildcards:

repo*form*invoice  

You, obviously, are quite comfortable with regular expressions. I'm not, but find that using wild cards almost always meet my needs, particularly since the intro of GF7 -- wild card matches now apply to entire statements and not just single lines.

Jimrnelson commented 2 months ago

@myearwood1

I think I'd have made GF an EXE.

Too late for that, that ship has sailed.

Even so, I wonder about some pitfalls with GF were it an EXE:

  1. My guess is that the EXE would not be able to search files already open in the IDE, such as projects. Both the scopes "Active Project" and "All Open Projects" require accessing open PJXs, which can't be opened by other executables.
  2. GF allows you to open files for editing (even if you can't use this feature because of your use of VFP6.) You wouldn't be able to do so from the EXE.

All a moot point, as I do not expect any movement to a EXE.

myearwood1 commented 2 months ago

Fox is different that way. A Fox exe does not have to be called as other exes. The exe running in the development environment can be debugged etc. I wouldn't doubt it till you see it.

I'm not comfortable with regex by far. There are people who speak it like they were genetically modified to use it. I did start chatting with the vfp2c32.fll developer. He did the neatest code I've seen in a while. He had FoxPro ask windows to read in a file in multiple pieces asynchronously

Jimrnelson commented 2 months ago

Fixed in Version 7.1.15 - 2024-07-10

myearwood1 commented 2 months ago

Yes. I tried it and it's much better. THERE*IS*NO took 19.1 seconds (565 lines in 170 files) and THERE\s+IS\s+NO regex took 29.7 seconds (355 lines in 126 files). The regex is specific about white space where the * grabs everything between THERE and IS.

Jimrnelson commented 2 months ago

@myearwood1

The dramatic speed improvement in RegEx searching (thanks!) is less than three months old.

Until then, regex searching was so painfully slow that I am sure most devs avoided it altogether and were content to put up with the extra chaff to put up with from wild card searching. Thus the habits were formed.

myearwood1 commented 2 months ago

Thanks for your efforts to make that happen. Just so you know, since I've seen the vfp232c guys work, I'm still trying for a module that can read in content and regex it in one massive gulp, from inside vfp. That will allow you to handle any number of files or memo fields or memory variable. That will give you a single regex implementation that can handle some of the more powerful features of regex.