Index: formatting.php
===================================================================
--- formatting.php	(revision 15501)
+++ formatting.php	(working copy)
@@ -1743,7 +1743,7 @@
 		$sub = trim( $sub, " \t\n\r\0\x0B-" );
 
 		// Test for invalid characters
-		$sub = preg_replace( '/^[^a-z0-9-]+$/i', '', $sub );
+		$sub = preg_replace( '/[^a-z0-9-]+/i', '', $sub );
 
 		// If there's anything left, add it to the valid subs
 		if ( '' !== $sub ) {
