I am having trouble removing a pipe character using Regex.Replace -
see the 2 NUnit tests below:
The first replace works fine and the second Replace does not work.
I've tried escaping the pipe character.
Can anyone get this to work?
Thanks
Glenn
using System;
using NUnit.Framework;
using System.Text.RegularExpressions;
namespace ScratchPad
{
[TestFixture] public class ScratchPad
{
[Test] public void RegexReplace_o()
{
Regex r = new Regex("bob");
Match m = r.Match("bob");
Assert.AreEqual(true,m.Success);
Assert.AreEqual("bb",Regex.Replace("bob","o",""));
}
[Test] public void RegexReplace_bar()
{
Regex r = new Regex("b|b");
Match m = r.Match("b|b");
Assert.AreEqual(true,m.Success);
//Assert.AreEqual("bb",Regex.Replace("b|b","|",""));
}
}
}