Hi All,
I have a string in a variable something like below
"Line1[0]: Bang\r\nLine2[0]: xyz\r\nCity[1]: hwjhdwj"
After parsing the string Now i want to remove the the contents [0] and [1]. After the manupulations it should give the output as
"Line1: Bang\r\nLine2: xyz\r\nCity: hwjhdwj"
Do anyone has any idea???
Thanks,
Prasant
Loading

Jignesh TrivediPosted Jul 17, 2012, 11:40 PM
you can also use Reges.Replace for same..
try
string input = "Line1[0]: Bang\r\nLine2[0]: xyz\r\nCity[1]: hwjhdw" ;
string pattern = @"\[0\]|\[1\]";
string replacement = "";
Regex rgx = new Regex(pattern);
string result = rgx.Replace(input, replacement);
hope this will help you.
VulpesPosted Jul 17, 2012, 11:59 AM