in reply to Possible to have regexes act on file directly (not in memory)
Is it possible to let a regular expression act directly on a file *without* reading any part of the file to memory?
No, a cpu can only see data in memory, so to process a file stored on disk you have to read some of it into memory.
However, you could write a streaming parser that reads the file one byte at a time, backtracking might be somewhat costly but it will depend on the sort of patterns you want to match. Have a look at streaming XML parsers for ideas how you might go about this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Possible to have regexes act on file directly (not in memory)
by Nocturnus (Scribe) on May 04, 2014 at 07:47 UTC |