Using Regular expression to replace escape characters

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
 
B

Beemer Biker

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, "");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top