I’m trying to loop through all the lines of a file and for each line that contains a ” I’m trying to replace the match with the line itself but with a ” at the end too.
I’m using syntax like this from .NET/C#:
Regex re = new Regex("/\"/"); // without escaping would be /"/
re.Replace(" someAttr=\"some text here", "$0\"");
Try the following:
First, you need to lose the slashes surrounding your regex.
According to this .NET regex reference page,
$&is the reference to the entire match, not$0.Also with your current method, you would just be replacing one double-quote with two consecutive double-quotes. Since you want to add the new double-quote to the end of the line you need to make your regex match to the end of the line, which is what the
.*does.Example: http://ideone.com/K5A7D