.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Text.RegularExpressions;

public class Program
{
	public static void Main()
	{
		string pattern = @"\b([\-]?\d[\-]?){11}\b";

        Regex rgx = new Regex(pattern);

        var sentence = "This is phone number 0341-2239548 and 021-34223311";

        var matches = rgx.Matches(sentence);

        foreach (Match match in matches)
        {
            string replacedValue = Regex.Replace(match.Value, @"[^0-9]", "");
            sentence = sentence.Replace(match.Value, replacedValue);
        }

        Console.WriteLine(sentence);
	}

	
}
;