On 2/18/2009 2:55:42 PM, Christian Ziemski wrote:
>
>Replace("this", "that", BEGIN+NOERR+ALL+LOCAL+REGEXP)
>Replace("foo", "bla", BEGIN+NOERR+ALL+LOCAL+REGEXP)
>...
>
>should do it.
Does that work? If I understand it correctly, the LOCAL option causes replace to be done only on the part of file that is currently in memory. That is why the explicit read/write commands are needed. If you just omit them, only the buffered part of the file (128k?) will be processed. Therefore you should omit the LOCAL keyword, too.
The code in the PDF manual is different from huge-sr.vdm, so the manual should be fixed. I think the problem is that if the search string happens to be at the edge of the buffered block, it is not found. That is why huge-sr.vdm uses Replace_Block and limits the search to full lines. But that still does not work with multi-line patterns.
Another way to do multiple search is to use search pattern |{}. For example:
Repeat(ALL) {
Search("|{fee,fie,foe,foo}", ERRBREAK)
if (Match_Item==1) { Replace("fee", "plugh" }
if (Match_Item==2) { Replace("fie", "xyzzy" }
...
}
This should not cause any problems with buffering.