An even better url_title helper. Tests: http://codepad.org/tuJgvkyN
Changelog entry added for 2.1.1
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 9f4b852..cdb6dae 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -478,27 +478,14 @@
 {
 	function url_title($str, $separator = 'dash', $lowercase = FALSE)
 	{
-		if ($separator == 'dash')
-		{
-			$search		= '_';
-			$replace	= '-';
-		}
-		else
-		{
-			$search		= '-';
-			$replace	= '_';
-		}
+		$replace = $separator == 'dash' ? '-' : '_';
 
 		$trans = array(
-						'&\#\d+?;'				=> '',
-						'&\S+?;'				=> '',
-						'\s+'					=> $replace,
-						'[^a-z0-9\-\._]'		=> '',
-						$replace.'+'			=> $replace,
-						$replace.'$'			=> $replace,
-						'^'.$replace			=> $replace,
-						'\.+$'					=> ''
-					);
+			'&.+?;'			=> '',
+			'[^a-z0-9 _-]'	=> '',
+			'\s+'			=> $replace,
+			$replace.'+'	=> $replace
+		);
 
 		$str = strip_tags($str);
 
@@ -512,7 +499,7 @@
 			$str = strtolower($str);
 		}
 
-		return trim(stripslashes($str));
+		return trim($str, $replace);
 	}
 }