Regex.Replace issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I am having problem using Regex.Replace.I am trying to search all the
strings present in a .cs file and replace it with a different string .I am
doing this by searching all the code which comes under ""(double quotes).

Code for Replacement:
System.Text.RegularExpressions.Regex.Replace(str, "\"" + fstring + "\"",
resxName + "." + ResxItemName);

The string under double in 'fstring'
' "\"" ' is used since I am reading the file using TextWriter.

Issue is I get parsing error for the following:
1.When ftsring="******Hello*****"
2.When fstring="{1,6730(100329.oti(*.8))}"

Also fstring="\\Test\\\TestSource" doesnot give an error but the 'ftsring'
is not replaced either.

Please let me know where am I going wrong.

Thanx in advance!
Regards,
Neeta
 
Neeta said:
I am having problem using Regex.Replace.I am trying to search all the
strings present in a .cs file and replace it with a different string .I am
doing this by searching all the code which comes under ""(double quotes).

Code for Replacement:
System.Text.RegularExpressions.Regex.Replace(str, "\"" + fstring + "\"",
resxName + "." + ResxItemName);

The string under double in 'fstring'
' "\"" ' is used since I am reading the file using TextWriter.

Issue is I get parsing error for the following:
1.When ftsring="******Hello*****"
2.When fstring="{1,6730(100329.oti(*.8))}"

Also fstring="\\Test\\\TestSource" doesnot give an error but the 'ftsring'
is not replaced either.

Please let me know where am I going wrong.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
Back
Top