Regular Expressions in the Contents of Find Files
-
Dan Phillips
- Posts: 5
- Joined: 17 Oct 2008 07:16
Regular Expressions in the Contents of Find Files
It would be good if the user could specify a regular expression in the Contents tab of Find Files. I would find such a feature very useful, and (I imagine!) it would be straightforward to implement.
-
j_c_hallgren
- XY Blog Master
- Posts: 5826
- Joined: 02 Jan 2006 19:34
- Location: So. Chatham MA/Clearwater FL
- Contact:
Re: Regular Expressions in the Contents of Find Files
Hi and wlcome to the XY forums!
Is this the same as this recent wish? http://www.xyplorer.com/xyfc/viewtopic.php?f=5&t=3030
Is this the same as this recent wish? http://www.xyplorer.com/xyfc/viewtopic.php?f=5&t=3030
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
-
Dan Phillips
- Posts: 5
- Joined: 17 Oct 2008 07:16
Re: Regular Expressions in the Contents of Find Files
Thanks jch.j_c_hallgren wrote:Hi and wlcome to the XY forums!
No, that's a different thing.Is this the same as this recent wish? http://www.xyplorer.com/xyfc/viewtopic.php?f=5&t=3030
-
admin
- Site Admin
- Posts: 66308
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Regular Expressions in the Contents of Find Files
straightforward to implement... depends.Dan Phillips wrote:It would be good if the user could specify a regular expression in the Contents tab of Find Files. I would find such a feature very useful, and (I imagine!) it would be straightforward to implement.
FAQ | XY News RSS | XY X
-
Dan Phillips
- Posts: 5
- Joined: 17 Oct 2008 07:16
Re: Regular Expressions in the Contents of Find Files
Good point. You would have to load the entire file into a string---i.e into memory---in order to feed it into the RegExp engine, which as you say could be problematic.admin wrote:straightforward to implement... depends.For small files, sure. But content search is, of course, built to deal with files of any length. I don't know what the RegExp engine (which I have not written myself but am using) will do when I feed it 2GBs of data...
Do you mean walking through the file line by line? That is how grep works. I think would be fine. What happens when a line is over the 1000 bytes though? You would give up on that line, but would you communicate that fact to the user? If so, that would present a user interface challenge; if not, then it would be a silent failure (bad).PS: If one would deliberately limit the size of the found match to say 1000 bytes then RegExp -- and also simple wildcards!! -- would be possible. E.g. if I search for "a*b" then a match would be only found where "a" and "b" are within a string of 1000 bytes.
I take back my claim that it would be straightforward to implement!
-
admin
- Site Admin
- Posts: 66308
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Regular Expressions in the Contents of Find Files
Well I just uploaded the feature and explained now I did it and what are the rules. I don't read linewise but chunkwise, and the chunks overlap by 1024 bytes if a wildcard pattern is stated.Dan Phillips wrote:Good point. You would have to load the entire file into a string---i.e into memory---in order to feed it into the RegExp engine, which as you say could be problematic.admin wrote:straightforward to implement... depends.For small files, sure. But content search is, of course, built to deal with files of any length. I don't know what the RegExp engine (which I have not written myself but am using) will do when I feed it 2GBs of data...
Do you mean walking through the file line by line? That is how grep works. I think would be fine. What happens when a line is over the 1000 bytes though? You would give up on that line, but would you communicate that fact to the user? If so, that would present a user interface challenge; if not, then it would be a silent failure (bad).PS: If one would deliberately limit the size of the found match to say 1000 bytes then RegExp -- and also simple wildcards!! -- would be possible. E.g. if I search for "a*b" then a match would be only found where "a" and "b" are within a string of 1000 bytes.
I take back my claim that it would be straightforward to implement!
FAQ | XY News RSS | XY X
-
admin
- Site Admin
- Posts: 66308
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Regular Expressions in the Contents of Find Files
Sorry, confusion, I did not yet do RegExp!admin wrote:Well I just uploaded the feature and explained now I did it and what are the rules. I don't read linewise but chunkwise, and the chunks overlap by 1024 bytes if a wildcard pattern is stated.Dan Phillips wrote:Good point. You would have to load the entire file into a string---i.e into memory---in order to feed it into the RegExp engine, which as you say could be problematic.admin wrote:straightforward to implement... depends.For small files, sure. But content search is, of course, built to deal with files of any length. I don't know what the RegExp engine (which I have not written myself but am using) will do when I feed it 2GBs of data...
Do you mean walking through the file line by line? That is how grep works. I think would be fine. What happens when a line is over the 1000 bytes though? You would give up on that line, but would you communicate that fact to the user? If so, that would present a user interface challenge; if not, then it would be a silent failure (bad).PS: If one would deliberately limit the size of the found match to say 1000 bytes then RegExp -- and also simple wildcards!! -- would be possible. E.g. if I search for "a*b" then a match would be only found where "a" and "b" are within a string of 1000 bytes.
I take back my claim that it would be straightforward to implement!
FAQ | XY News RSS | XY X
-
Dan Phillips
- Posts: 5
- Joined: 17 Oct 2008 07:16
Re: Regular Expressions in the Contents of Find Files
That's clever how you've done it. (I assume you search a chunk of 32768 bytes, and then jump forward 32768 - 1024 = 31744 bytes, and then search again.)admin wrote:Well I just uploaded the feature and explained now I did it and what are the rules. I don't read linewise but chunkwise, and the chunks overlap by 1024 bytes if a wildcard pattern is stated.
Is 1001 correct? I think it should be 1025.It also *might* be found if "a" and "b" are within a range of 1,001 to 32,768 bytes!
-
admin
- Site Admin
- Posts: 66308
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Regular Expressions in the Contents of Find Files
Yep, you assume alright.Dan Phillips wrote:That's clever how you've done it. (I assume you search a chunk of 32768 bytes, and then jump forward 32768 - 1024 = 31744 bytes, and then search again.)admin wrote:Well I just uploaded the feature and explained now I did it and what are the rules. I don't read linewise but chunkwise, and the chunks overlap by 1024 bytes if a wildcard pattern is stated.Is 1001 correct? I think it should be 1025.It also *might* be found if "a" and "b" are within a range of 1,001 to 32,768 bytes!
Oh, yes, 1025. I first overlapped 1000 chars, but then decided to "think binary"...
FAQ | XY News RSS | XY X
-
lhsisson
- Posts: 2
- Joined: 30 Nov 2008 18:14
Re: Regular Expressions in the Contents of Find Files
I recently purchased XYPlorer and am just getting started with it. I'm a programmer and I'm very interested in incorporating regexp content searching if that is possible. Has anyone found a way to do this? A couple of editors I use (Notepad++, UltraEdit) implement that capability.
Thanks, Len
Thanks, Len
-
admin
- Site Admin
- Posts: 66308
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Regular Expressions in the Contents of Find Files
Hi Len, welcome!lhsisson wrote:I recently purchased XYPlorer and am just getting started with it. I'm a programmer and I'm very interested in incorporating regexp content searching if that is possible. Has anyone found a way to do this? A couple of editors I use (Notepad++, UltraEdit) implement that capability.
Thanks, Len
The easiest way would be if I added that feature. So I take this as a wish.
FAQ | XY News RSS | XY X
-
lhsisson
- Posts: 2
- Joined: 30 Nov 2008 18:14
Re: Regular Expressions in the Contents of Find Files
Yes, do please take this as a wish.
In the meantime, is it possible through the scripting to launch a grep program such as Astrogrep for the directory currently selected? Astrogrep can be attached as a context menu item to Explorer. That would be a great capability to add to XYplorer in general (not just for Astrogrep) It is open-source so the source is available (VS 2003 .NET 1.1) http://astrogrep.sourceforge.net/
Unfortunately, it is against company policy to install such software on the company notebook I'm using for most my software development at the present time. That is why I purchased XYplorer, since it can run portable. Again, I'm a newbie to XYplorer so I'll be exploring such capabilities while waiting for the wish to come true.
Thanks for a great product!
In the meantime, is it possible through the scripting to launch a grep program such as Astrogrep for the directory currently selected? Astrogrep can be attached as a context menu item to Explorer. That would be a great capability to add to XYplorer in general (not just for Astrogrep) It is open-source so the source is available (VS 2003 .NET 1.1) http://astrogrep.sourceforge.net/
Unfortunately, it is against company policy to install such software on the company notebook I'm using for most my software development at the present time. That is why I purchased XYplorer, since it can run portable. Again, I'm a newbie to XYplorer so I'll be exploring such capabilities while waiting for the wish to come true.
Thanks for a great product!
-
admin
- Site Admin
- Posts: 66308
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Regular Expressions in the Contents of Find Files
That can easily be done through scripting or through a UDC. What's the command line syntax for Astrogrep to open a directory?lhsisson wrote:Yes, do please take this as a wish.
In the meantime, is it possible through the scripting to launch a grep program such as Astrogrep for the directory currently selected? Astrogrep can be attached as a context menu item to Explorer. That would be a great capability to add to XYplorer in general (not just for Astrogrep) It is open-source so the source is available (VS 2003 .NET 1.1) http://astrogrep.sourceforge.net/
FAQ | XY News RSS | XY X
XYplorer Beta Club