Lets say I want to prepend every line in a file with some string. I am using the following
file(READ input_file filedata)
string(REGEX REPLACE "([^\n]+)\n" "Hello : \\1\n" filedata ${filedata})
file(WRITE output_file "${filedata}")
Which works fine expect for semicolons which disappear from the output. I understand that semicolons are special in that they are used as a list separators although I don't understand enough to explain why they disappear. So is there a way to not treat them or any other character as special, I want the \1 in the output to simple be the actual text in the input.