Regex

  • Thread starter Thread starter MattC
  • Start date Start date
M

MattC

How can the following be represented using regex?

html = html.Replace("\n", "");
html = html.Replace("\t", "");
html = html.Replace("\r", "");

TIA
 
start with \n and so on:
System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(\\n);

string newString = r.Replace("\n",string.Empty);

once you get new string, run the pattern with \\t and then \\r and so on
 
How can the following be represented using regex?

html = html.Replace("\n", "");
html = html.Replace("\t", "");
html = html.Replace("\r", "");

TIA

Matt,

html = Regex.Replace(html, @"[\n|\r|\t]", "");
 

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

Similar Threads


Back
Top