Regex!
Quote:
In computing, a regular expression is a specific pattern that provides concise and flexible means to "match" (specify and recognize) strings of text, such as particular characters, words, or patterns of characters. Common abbreviations for "regular expression" include regex and regexp.
Here's a regex example with your string:
the only thing you have to edit is the
RegexPattern
var
using System;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{
string input = "<div id="header"></div> <div id="body"></div> <div id="footer"></div>";
string RegexPattern = "body";
string output = Regex.Replace(input, RegexPattern , "");
Console.WriteLine(input);
Console.WriteLine(output);
}
}
See example of using regex in javascript
http://stackoverflow.com/questions/9960421/regular-expression-replace-in-javascript[
^]
Cheers,
Edo