P
PJ
I'm having trouble with the Replace method on a RegEx instance. The target
value is "TermsOfUse" and I would like to get the string "Terms Of Use"
using regular Expressions. Here is what I have so far
String target = "TermsOfUse";
RegEx reg = New RegEx("(?<end>[a-z])(?<beg>[A-Z])");
Match check = reg.Match(target);
if ( check.Success )
target = reg.Replace(target, check.Groups["end"].Value + " " +
check.Groups["beg"].Value);
Console.WriteLine(target);
// spits out "Terms Os Ose"
It's replacing every Match, but only using the captures from the first
Match. How do I remedy this?
TIA~ PJ
value is "TermsOfUse" and I would like to get the string "Terms Of Use"
using regular Expressions. Here is what I have so far
String target = "TermsOfUse";
RegEx reg = New RegEx("(?<end>[a-z])(?<beg>[A-Z])");
Match check = reg.Match(target);
if ( check.Success )
target = reg.Replace(target, check.Groups["end"].Value + " " +
check.Groups["beg"].Value);
Console.WriteLine(target);
// spits out "Terms Os Ose"
It's replacing every Match, but only using the captures from the first
Match. How do I remedy this?
TIA~ PJ