removeHTML - RegEx Replace to remove HTML <tags>


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. using System.Text.RegularExpressions;
  2.  
  3. public string removeHTML(string input)
  4. {
  5. string pattern = @"<(.|\n)*?>";
  6. Regex regex = new Regex(pattern, RegexOptions.Singleline);
  7.  
  8. string output = regex.Replace(input, string.Empty);
  9.  
  10. return output;
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.