Tuesday, October 28, 2014

Remove special characters from SPUser

When you are retrieving the SharePoint Group / User detail on custom application page or webpart you might seen those details were comes with special character and number format.
The number denotes the SiteUser Id or Group Id in the site collection.
To removing the special character and number in the scrambled text use this simple Regular expression format
This stripes the number and special character from the string.
string Name = "1234;#Murugesa Pandian";
Regex.Replace(Name, @"[0-9#;]", string.Empty);