Page 1 of 2

Tool to search for code

Posted: Thu Jan 24, 2019 4:56 am
by CarolC1
I would like to be able to search for bits of code in phpBB without having to CTRL+F one file at a time. There has to be a better way. For example, right now I would like to find all instances of EMAIL_TAKEN_EMAIL in phpBB 3.2.5 besides the language file. Is there some kind of software that will search a whole phpBB download or at least one directory at a time? Preferably free. I tried google and found something called DocFetch, not sure if that's what I want or if people might recommend something else. Thank you.

Re: Tool to search for code

Posted: Thu Jan 24, 2019 6:07 am
by AbaddonOrmuz
If you run Windows, you can use Notepad++ it has the function "Find in files", so you can download the package and search for text in that directory recursively, you can even filter file types, like just PHP or HTML files.

If you use GNU/Linux you can use Notepadqq.

Re: Tool to search for code

Posted: Thu Jan 24, 2019 6:34 am
by Lumpy Burgertushie
I do believe that language file is the only place you would find that exact variable.
there would be no need for it to be anywhere else since it is a language variable that is only used in one place.

maybe if you explained what you are trying to do ( not how you think it should be done ) we can help you accomplish it.
luck,
robert

Re: Tool to search for code

Posted: Thu Jan 24, 2019 7:22 am
by warmweer
Although I prefer to use a dedicated program when searching for text, this can be done with Windows.
Have a look at https://www.howtogeek.com/99406/how-to- ... ws-search/

Re: Tool to search for code

Posted: Thu Jan 24, 2019 8:35 am
by AmigoJack
Let me use what most people don't use in the internet: links. And additional suggestions:
  • Notepad++, the free software for Windows
  • Notepadqq, for Linux/Unix
  • TextPad for Windows, not free but my favorite over decades
  • findstr in Windows' command line, a software that is guaranteed to be there with every OS installation; an example usage would be findstr /s /c:EMAIL_TAKEN_EMAIL E:\phpBB\*.php
Which editor are you currently using? Searching thru files is essential to me - I would not even waste my time looking at files separately, not to speak of dealing with all the matches at once.

Re: Tool to search for code

Posted: Thu Jan 24, 2019 3:05 pm
by Brf
Using Notepad++ works great, but it will only find that one code line. When the string is actually used, it is built in pieces, so you have to search for the pieces:

Re: Tool to search for code

Posted: Thu Jan 24, 2019 5:14 pm
by CarolC1
@AbaddonOrmuz, thank you, that sounds like what I need. I've seen it mentioned here for editing many times, but I use EditPlus3 so I've never tried it. Did not know it would search files, and I'm probably going to wish I'd had it a long time ago. :D

@Lumpy Burgertushie, thanks for the tip. I am actually looking at customizing an extension, and I know extensions questions belong under Discussion for the extension in the extensions database. I asked the author a question there a few weeks ago and there was no reply. That's OK, I need to try to understand this better anyway.

@warmweer, I didn't know about this, thanks, I do have Windows. I had been trying to use the search feature in Windows up in the top right corner when you have a folder open, but it often (usually, it seems) says no results even when the code is definitely there.

@AmigoJack, seriously I will look at TextPad. Different things work better for different people, and if it turns out to be better I won't mind paying for it, thank you.

@brf, thanks! I think you not only answered my question, but also sold me on Notepad++. :D

Thanks, everyone, this is a big help!

Re: Tool to search for code

Posted: Thu Jan 24, 2019 6:00 pm
by Lumpy Burgertushie
not knocking notepad++ at all, it is a great tool
however, it seems that the one you have , that you paid for, has pretty much the exact feature set as notepad++
I just looked it up. it does not specifically state that you can search folders etc. neither does the feature page of notepad++ the last time I checked.

just a little fyi


robert

Re: Tool to search for code

Posted: Thu Jan 24, 2019 6:10 pm
by warmweer
CarolC1 wrote:
Thu Jan 24, 2019 5:14 pm
@warmweer, I didn't know about this, thanks, I do have Windows. I had been trying to use the search feature in Windows up in the top right corner when you have a folder open, but it often (usually, it seems) says no results even when the code is definitely there.
Most people don't know (I didn't until a couple of years ago) that the search only looked in files with specific extensions (and the lnk I gave you shows how to extend the range of files the search will look into.

Re: Tool to search for code

Posted: Thu Jan 24, 2019 6:28 pm
by CarolC1
Oh dear,
AbaddonOrmuz wrote:Notepad++ it has the function "Find in files"

Everybody ready for a good laugh? I took a look at EditPlus3. :roll:
Find_in_files.PNG
It was there all this time for...how long? Well, I have plenty of other options to try or compare now, after I try the one that has been on my computer for I-won't-say-how-many-years! :lol:
warmweer wrote:Most people don't know (I didn't until a couple of years ago) that the search only looked in files with specific extensions (and the lnk I gave you shows how to extend the range of files the search will look into.
Thanks, that explains what I'd been wondering about, why sometimes it would work and sometimes not. It makes sense now. :D
Lumpy Burgertushie wrote:
Thu Jan 24, 2019 6:00 pm
however, it seems that the one you have , that you paid for, has pretty much the exact feature set as notepad++
I just looked it up. it does not specifically state that you can search folders etc. neither does the feature page of notepad++ the last time I checked.
Yup, you're absolutely right! Gonna try it now. :D

Re: Tool to search for code

Posted: Thu Jan 24, 2019 6:50 pm
by warmweer
CarolC1 wrote:
Thu Jan 24, 2019 6:28 pm
Find_in_files.PNG
Nice, I still use that also, but notepad++ can handle really large text files (up to 2GB IIRC).
For really huge files I have EM Editor (which I have used only once really, to split a 3.5GB database backup)

Re: Tool to search for code

Posted: Thu Jan 24, 2019 7:10 pm
by Lumpy Burgertushie
I have been using editpad plus for years. it basically has everything notepad++ has except for the syntax highliting.
It will open as many files/as big a file as your system has memory to support. the closer you get to your system memory limit the slower it works.

I may go back and try notepad++ again to see if it actually allows you to search folders without having to actually select the files first.


robert

Re: Tool to search for code

Posted: Thu Jan 24, 2019 9:41 pm
by CarolC1
warmweer wrote:
Thu Jan 24, 2019 7:22 am
Although I prefer to use a dedicated program when searching for text, this can be done with Windows.
Have a look at https://www.howtogeek.com/99406/how-to- ... ws-search/
I tried the advanced indexing option as suggested above and that seems to have worked, though I don't understand the details of what went on when I did it. One at a time I asked it to index .php, .htm, and .html. On .php it first said "this may take a long time" then completed immediately. It warns you some results may be incomplete while it is indexing. I tested it and did not get any results for EMAIL_TAKEN. Checked the task manager to see if it was still indexing. SearchIndexer.exe is running so it must still be busy. Anyway, checked it again and this time it matched brf's results. I'm very glad for that screenshot to compare results to.

May still try something else, but it's really nice to have the basic Windows search hoovering up the contents of these files now and they are searchable.

Thank you again!
email_taken.PNG

Re: Tool to search for code

Posted: Fri Jan 25, 2019 9:34 am
by AmigoJack
CarolC1 wrote:
Thu Jan 24, 2019 6:28 pm
It was there all this time
In at least one language this is called "tunnel vision": over years you continue to focus on only those things you already knew and likewise never think of just making sure it's indeed everything there is to know. But then again I met enough people not even browsing thru menus and settings of software to seek something, they just complain.

warmweer wrote:
Thu Jan 24, 2019 6:50 pm
notepad++ can handle really large text files (up to 2GB IIRC).
For really huge files I have EM Editor
TextPad can eat files bigger than 2 GiB, one of the advantages of its lightweightness over i.e. Notepad++. Another thing is its more trustworthy regular expression engine.

CarolC1 wrote:
Thu Jan 24, 2019 9:41 pm
SearchIndexer
I never trusted Windows to properly read all the files, let alone waste the CPU power by indexing content again and again. Sooner or later you want to search thru something that isn't indexed (like portable storage devices, i.e. USB keys, or network shares) and then "no matches" won't tell you what was searched and what was skipped.

Re: Tool to search for code

Posted: Fri Jan 25, 2019 1:33 pm
by warmweer
AmigoJack wrote:
Fri Jan 25, 2019 9:34 am
warmweer wrote:
Thu Jan 24, 2019 6:50 pm
notepad++ can handle really large text files (up to 2GB IIRC).
For really huge files I have EM Editor
TextPad can eat files bigger than 2 GiB, one of the advantages of its lightweightness over i.e. Notepad++. Another thing is its more trustworthy regular expression engine.
I never tried Textpad because of the lack of info about the differences between the versions available. I also find it strange that the Community Forum uses a seriously outdated phpBB version (it not as though it's modified in such a way to make upgrading a difficult job).

Added: still 2 versions available 8.1.2. and 7.6.4 but no info