1

Is there a way to use the regex class of boost to search in a file without completely reading it into memory?

I currently read a file per line and this makes the parsing quite complicate compared to searching via regex. I do it per line because the files can be huge and I don't want to waste to much RAM.

The regex expression I would like to use is, and it works fine if I use it for Example in Notepad++

Block *\{([^\}]*?)MY_TOOL_Library([^\}]*?)\}
nobs
  • 708
  • 6
  • 25

1 Answers1

2

I don't think boost regex implements this. They require a bi-directional iterator.

Formally, "regular expressions" (in the mathematical sense) allow one pass parsing, and can be made to work with a forward iterator. But boost, like most other regular expressions, implements capture (an extension to the formal definition), and I think that this precludes a true one pass algorithm (or makes it extremely difficult).

James Kanze
  • 150,581
  • 18
  • 184
  • 329
  • This I already know But I asked if there is a workaround available Looks likes there is no "easy" way around.. – nobs Aug 13 '12 at 13:22