Remove extra spaces from string using regular expression,, c#

Removes extra space from the string using Regular expression. public static readonly RegexOptions Options =          RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline; public string RemoveExtaSpaces(string text) { Regex regex = new Regex(@”\s{2,}”, Options); text = regex.Replace(text.Trim(), ” “); //This line removes extra spaces and make space exactly one. //To remove the  space between the end of a word […], programming

Comments Off on Reqular experssion RegEx, C# , ,

Reqular experssion RegEx, C# , ,

Regular expression: Regular Expression is a great way to manipulate strings for example matching, finding, validating Data, Specailly string manipulaion becames handy while we use reqular expression. We can use Regular expression on both Serer and client side. We do use it with validation controls. Charcther matching: . ^ $ * + ? { […]