I think you misunderstood something.
You can/should read the file all at once with my approach (I already assumed you were doing this based on comments elsewhere in the thread and because, as you note above, you need to match multi-line comments).
Just use your existing file-reading code. I only rewrote the code you provided so you only need to replace that part of your code (except I didn't bother to repeat the close statement). (update:) nor the file reading code (my mind simply blocked out the that part of your code).
In reply to Re^3: Regex "(un)Knowledge" (loop)
by tye
in thread Regex "(un)Knowledge"
by nofernandes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |