I have a big piece of text, and i know at what line number a specific piece of string occurs. I need to replace that with something else. But how can i replace a certain string only at a certain line number?
Example text:
1: Lorem ipsum dolor sit amet, [[consectetur]] adipiscing elit. Aliquam
2: imperdiet dolor ut urna hendrerit tempus in sit amet nibh. Maecenas
3: est est, imperdiet quis tristique pulvinar, convallis et justo.
4:
5: Duis nulla lacus, [[aliquet]] at ornare nec, ultricies ac erat. Aliquam
6: dignissim, tellus et pharetra [[rhoncus]], magna nisi scelerisque urna, in
7: imperdiet [[metus]] orci id risus.
In this case, i only want to replace the [[
characters at line 1
and at line 6
with --
(two dashes).
Is there an easy of doing this in PHP?