public static String UrlRewriteText(string input)
{
string final = input.Trim();
final = final.Replace("'", "");
Regex stripStuff = new Regex("([^a-zA-Z0-9])");
final = stripStuff.Replace(final, "-");
stripStuff = new Regex("_{1,}");
final = stripStuff.Replace(final, "-");
stripStuff = new Regex("_$");
final = stripStuff.Replace(final, "");
stripStuff = new Regex("^_");
final = stripStuff.Replace(final, "");
while (final.IndexOf("--") > 0)
{
final = final.Replace("--", "-");
}
if (final.EndsWith("-"))
{
final = final.Remove(final.Length - 1);
}
return (final);
}