**cblake**,thanks

I was just trying to work with memSlices, but I got strange results. I'm at a 
loss. How to properly write? This test code: 
    
    
    import memfiles
    import strutils
    import nre
    
    var  count = 0
    var line:string
    
    var fMem = memfiles.open("1.txt", fmRead)
    
    let pattern = "a"
    let rex = pattern.re
    for slice in fMem.memSlices:
       if slice.size > 0 :
         line = $(cast[cstring](slice.data))        # correct to you?
         if line.match(rex).isSome:
           #echo nre.replace(line, rex, "b")         # this does not work  - 
the program hangs
           echo strutils.replace(line,pattern, "b") # it works
         inc(count)
    
    echo count
    
    fMem.close
    

Reply via email to