> I want a string
> abc:{def} ijk:{xyx}
[quoted text clipped - 6 lines]
>
> can someone help
I think you have to use a MatchEvaluator.
// demonstration calling code
// assuming:
// using System.Text.RegularExpressions
string s = "abc{def}";
string t = Regex.Replace(s, "{.*}", new MatchEvaluator(MatchToUpper));
// somewhere else
static string MatchToUpper(Match m)
{
return m.Value.ToUpper();
}

Signature
Larry Lard
Replies to group please
Oliver Sturm - 02 Aug 2005 19:38 GMT
> string t = Regex.Replace(s, "{.*}", new MatchEvaluator(MatchToUpper));
The regex should be "\{.*?\}". Otherwise the curlies have special
meaning and the * will match greedily, so you'd get only one match in
the sample expression instead of two.
Oliver Sturm

Signature
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog