feature request - Regular Expressions
Moderators: Hacker, petermad, Stefan2, white
-
- New Member
- Posts: 1
- Joined: 2003-06-15, 19:44 UTC
feature request - Regular Expressions
I want Regular Expressions for searching files and text in files.
Re: feature request - Regular Expressions
Use "Search".Martin.Fusek wrote:I want Regular Expressions for searching files and text in files.
Christian Ghisler (author) wrote:
http://www.ghisler.ch/board/viewtopic.php?p=8126#8126I can tell you: TC 6.0 will support regular expressions as an option! It already works in search, multi-rename tool and select/unselect files. However, it will not be supported for text searches yet.
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
The problem is that the RegEx library needs the text to be searched to be in memory. This means that a regular expression couldn't stretch over a whole file. But I cannot simply pass blocks of, say, 64k to the function, with an overlap of 1k, because this way the RegEx function may find some matches larger than 1k, and miss some others. Any ideas?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
How does grep solve this problem?ghisler(Author) wrote:The problem is that the RegEx library needs the text to be searched to be in memory. [...] Any ideas?
I'm not sure, but I don't think that command line tools like grep load the whole file into memory. So there should be a solution. There is a gnu version of grep around so you could have a look at the source code....
[face=courier]On 20-06-2003 18:55:10 +0000 ghisler(Author) wrote:
g> Any ideas?
Mapped file
CreateFileMapping
FlushViewOfFile
MapViewOfFile
MapViewOfFileEx
OpenFileMapping
UnmapViewOfFile[/face]
g> Any ideas?
Mapped file
CreateFileMapping
FlushViewOfFile
MapViewOfFile
MapViewOfFileEx
OpenFileMapping
UnmapViewOfFile[/face]
[face=courier]The Protoss do NOT run from their enemies.
It is here, that we shall make our stand.[/face]
It is here, that we shall make our stand.[/face]
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Sorry, I cannot use mapped files with this library - it expects Delphi strings with length. But zero terminated strings wouldn't work either with binary files...
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- fabiochelly
- Power Member
- Posts: 603
- Joined: 2003-02-05, 12:03 UTC
- Location: Rambouillet, France
Did you try Systools RegEx component, is is open sources now and it works fineSorry, I cannot use mapped files with this library - it expects Delphi strings with length. But zero terminated strings wouldn't work either with binary files...
Fabio Chelly.
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
#60241
Lorsqu'on s'occupe d'informatique il faut faire comme les canards...
Paraître calme en surface et pédaler comme un forcené par en dessous
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Systools costs $300. But the price isn't the problem - I don't want to use any proprietary code in my program, there would be a danger of publishing code (e.g. in plugins) which belongs to someone else by mistake. I don't want to risk this.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Have you considered the following option: using an open source C-based regex library (such as PCRE, http://pcre.sourceforge.net/), and wrapping the functionality you need in a DLL (written in C), callable from your Delphi code? Or do you want to keep TC a monolithic executable as far as possible?
Why not a monolithic executable? I dont't like a program with so many dlls reside here and there.Lucas_C wrote:Have you considered the following option: using an open source C-based regex library (such as PCRE, http://pcre.sourceforge.net/), and wrapping the functionality you need in a DLL (written in C), callable from your Delphi code? Or do you want to keep TC a monolithic executable as far as possible?
How exactly does TC support regular expressions? When I do enter a simple expression like this:
It returns no files, while in the folder I'm searching there a re tons of files that fullfill this expression, like
asam03a013.jpg
dian01a067.jpg
And I could find *anything* about regexes in the helpfile... so what's cooking?
Code: Select all
[a-z]{4}[0-9]{2}[a-z][0-9]{3}\.jpg
asam03a013.jpg
dian01a067.jpg
And I could find *anything* about regexes in the helpfile... so what's cooking?