My script goes through the file line by line, not letter by letter. It should work even for large files where stuffing everything into memory might be a problem.
If you want to compare different solutions, benchmark. Benchmark can help you.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Comment on Re^3: Look Ahead regexp to insert line?