It is possible if you have how to know which is line 7. Of course, as long as there is no possibility of confusion with other parties. You changed everything to .
and on line 7 will return from .
for ,
. But let’s just say I already had something with .
there before changing ,
for .
, that .
that was already there will turn ,
. Is that what you want? If it is, ok. If there is no possibility of having a .
previous, ok, can do.
If it is not possible you can still do line by line and skipping line 7. But be careful if doing several replace()
will have a lot of memory allocation. In certain applications this is no problem, but be aware that there will be pressure on the Garbage Collector and in extreme cases there may be memory exhaustion. Even with a replace()
there will be a little pressure, today has techniques to do this more efficiently, but in this case it is probably excessive concern.
In the last case I could do manually analyzing each character, but if you do not know will have poor performance.
I updated! I tried to be clearer and objective, I hope I was able to explain my problem better
– Fábio Vitor
With regex on a line, replace the word line with Row on line 7:
Regex.Replace(texto_de_entrada, "(?<=^([^\n]+\n){6}[^\r]*)linha(?=[^\r]*.*)", "row", RegexOptions.Singleline)
– user178974