
feature request - Regular Expressions
Moderators: Hacker, petermad, Stefan2, white
How about boolean instead?
Given the problems with applying regular expressions to partially loaded files, how about a boolean AND/OR/NOT search instead? The regexp problem goes away, and although regexps are very cool , in practice I find boolean searches more useful when it comes to finding stuff in files. Especially if there's also a NEAR keyword, with a user-adjustable proximity setting.
No ads, no nags freeware: http://www.tranglos.com
(KeyNote, PhoneDeck, KookieJar, Oubliette)
(KeyNote, PhoneDeck, KookieJar, Oubliette)
There is indeed a GNU version of grep, but if my memory's right, it tries to match the pattern on a per-line basis, that is, it reads a line, try to see if there is a match, then the next line, and so on...shammat wrote: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....
I guess that could be a way of doing it, and to avoid binary files, looking if the file contains any char < 32 may be a way. Or throwing an error if after 64K read no \r\n|\r|\n was found, like "File seems to be binary data, I may have to read the entire file in memory, are you sure this is what you want ?". This amount could even be configurable.