Using Regular expression to replace escape characters

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

Guest

I have a string with some escape charaecters that need to be processed in our
file
Say for example the string might have something like following
<escape V=".sp2" />
step 1:
This has to be replaced to "escape V=".sp2"
step 2:
Later it has to be reversed as original(<escape V=".sp2" />) after some
processing.

We need a soln with respect to regex in C#.

There may may be many instances od this string in the file.so we need to
replace all instances.Please provide a solution
 
Guhanath said:
I have a string with some escape charaecters that need to be processed in
our
file
Say for example the string might have something like following
<escape V=".sp2" />
step 1:
This has to be replaced to "escape V=".sp2"
step 2:
Later it has to be reversed as original(<escape V=".sp2" />) after some
processing.

We need a soln with respect to regex in C#.

There may may be many instances od this string in the file.so we need to
replace all instances.Please provide a solution

If you just want to know how to set up a parser for regular expressions in
C# , use the following code segment as a guide:

Regex rex = new Regex(".*?;");
string answer;
byte[] out_string;
uint result;
for(Match m = rex.Match(CommBuffer); m.Success; m = m.NextMatch())
{
answer = parser.Get(m.Value);
out_string = AE.GetBytes(answer);
result = SIO.put(out_string, (uint) out_string.Length);
CommBuffer = CommBuffer.Replace(m.Value, "");
}
 
Back
Top