feature request - Regular Expressions

English support forum

Moderators: white, Hacker, petermad, Stefan2

Martin.Fusek
New Member
New Member
Posts: 1
Joined: 2003-06-15, 19:44 UTC

feature request - Regular Expressions

Post by *Martin.Fusek »

I want Regular Expressions for searching files and text in files.
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Re: feature request - Regular Expressions

Post by *djk »

Martin.Fusek wrote:I want Regular Expressions for searching files and text in files.
Use "Search".
Christian Ghisler (author) wrote:
I 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.
http://www.ghisler.ch/board/viewtopic.php?p=8126#8126
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
User avatar
Valentino
Power Member
Power Member
Posts: 706
Joined: 2003-02-07, 00:21 UTC
Location: Ukraine

Post by *Valentino »

Thanks djk!

Christian, I want regular expressions to search files!

(joke, can't resist, voices control me...)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

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
Jonas
Senior Member
Senior Member
Posts: 325
Joined: 2003-05-27, 16:59 UTC
Location: Germany
Contact:

Post by *Jonas »

Probably you could push this problem to the user.... so that the user can say (for each search; setting saved in .ini) how large the blocks and the lapping should be....

And it would be nice if the search-Dialog would not block the main window!
shammat
Senior Member
Senior Member
Posts: 253
Joined: 2003-04-11, 23:13 UTC

Post by *shammat »

ghisler(Author) wrote:The problem is that the RegEx library needs the text to be searched to be in memory. [...] Any ideas?
How does grep solve this problem?
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....
User avatar
Black Dog
Power Member
Power Member
Posts: 1024
Joined: 2003-02-05, 22:17 UTC
Location: Odessa
Contact:

Post by *Black Dog »

[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]
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

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
User avatar
fabiochelly
Power Member
Power Member
Posts: 603
Joined: 2003-02-05, 12:03 UTC
Location: Rambouillet, France

Post by *fabiochelly »

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...
Did you try Systools RegEx component, is is open sources now and it works fine
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
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

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
Lucas_C
Junior Member
Junior Member
Posts: 8
Joined: 2003-02-07, 13:38 UTC
Location: Finland

Post by *Lucas_C »

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?
User avatar
WatchUer
Senior Member
Senior Member
Posts: 243
Joined: 2003-02-22, 10:46 UTC
Location: China

Post by *WatchUer »

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?
Why not a monolithic executable? I dont't like a program with so many dlls reside here and there.
Thany
Senior Member
Senior Member
Posts: 292
Joined: 2003-09-30, 09:20 UTC
Location: Netherlands

Post by *Thany »

How exactly does TC support regular expressions? When I do enter a simple expression like this:

Code: Select all

[a-z]{4}[0-9]{2}[a-z][0-9]{3}\.jpg
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?
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Post by *djk »

TC is going to support regular expressions in 6.0 version. So you have to wait a moment ;-)
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
Thany
Senior Member
Senior Member
Posts: 292
Joined: 2003-09-30, 09:20 UTC
Location: Netherlands

Post by *Thany »

Sorry, guess I misunderstood...
It already works in search, multi-rename tool and select/unselect files.
This sounds like it already works, IOW in TC 5.51... Too bad I'm wrong. Looking forward to 6.0 though :D
Post Reply