Need some help, I have a regular expression that appears to work just fine when I put the pattern and string to parse into regexlib's tester. However, when I put it into C#, the same does not happen, no match.
Here is my match pattern, have tried both:
string regPattern = "\\{\\$([^\\$\\}]+)\\$\\}";
My string to parse comes from a database and is put into a variable after using ToString(). Here is a sample of the string (using Text Visualizer in VS2008) that works at regextlib but not in C#.
<p>1.Age?: -- Select One --<br />
2.HowFindProduct?: Friend/Relative Recommendation<br />
3.Influencers?: {$InfluencedDecision$}<br />
4.WherePurchase?: Office Superstore - i.e. Staples_ Office Depot_ Of<br />
5.ReplacementProduct?: This is a replacement to my previous product<br />
6.OtherBrands?: {$OtherBrands$}<br />
7.Income?: -- Select One --<br />
FirstName: John<br />
Initial: H<br />
LastName: Smith<br />
Address1: 123 any street<br />
Address2: suite 2<br />
City: any city<br />
State: CA<br />
ZipCode: 55555<br />
Country: usa<br />
EmailAddress: [email protected]<br />
Phone#: 714-555-1212<br />
ModelNumber: AXXXX<br />
SerialNumber: 23123d234s2s<br />
DateofPurchase: 09/09/2009<br />
NotifyMe1: on<br />
NotifyMe2: on</p>
And while simple, if it helps, here is the code I am using:
string regPattern = "\\{\\$([^\\$\\}]+)\\$\\}";
Regex.Replace(bodytext.ToString(), regPattern, "",RegexOptions.Multiline);
I have also tried declaring pattern using @ and Regex.Escape. Need some help here.
Any ideas?