The
Regex.Matches
method can be used to extract the decimal values of the characters and then
Select
method of
IEnumerable
can be used to convert each decimal value into character and then a
string
can be constructed from the array of
chars
as shown below:
string str = "& #1047;& #1076;& #1088;& #1072;& #1074;& #1077;& #1081;, & #1089;& #1074;& #1103;& #1090;";
MatchCollection charNums = Regex.Matches(str,@"(?<=#\s*)\d+(?=\s*)",
RegexOptions.CultureInvariant);
string strFinal = new string(charNums.OfType<Match>().Select (
m => (char)Convert.ToInt32(m.Value)).ToArray());
Console.WriteLine (strFinal);
Output
Здравейсвят