I have strings like :
“article.DOS = 998 and article.des = ‘toto.tata’ or article.des = “ot.o””
NB : the whole string is a single string.
I’d like to put every word.word in upper case, but not words beginning and ending with ‘ or “
My current regex is : Regex rgx = new Regex(@"\S+\.\S+");
In the end, my string should be :
“ARTICLE.DOS = 998 and ARTICLE.DES = ‘toto.tata’ or ARTICLE.DES = “ot.o””
To make it in upper case, I use :
private static string MeToUpper(Match m)
{
return m.Value.ToUpper();
}
internal string ToUpper(string codeSql)
{
Regex rgx = new Regex(@"\S+\.\S+");
return rgx.Replace(codeSql, new MatchEvaluator(MeToUpper));
}
Thanks
1 Answer