SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Jun 19, 2007, 07:03 #1
Removing all characters that are not #'s or letters
Is there a function that will remove all characters that aren't letters and numbers? I'm doing a mod_rewrite to include the title of the page in the URL and i don't want punctuation, etc to show up in the url
thanks!
-
Jun 19, 2007, 07:08 #2PHP Code:
$r = preg_replace('/[^a-z0-9]+/i', '', $s);
-
Jun 19, 2007, 07:15 #3
thanks! but how can i modify that to keep spaces or dashes?
-
Jun 19, 2007, 07:27 #4PHP Code:
$r = preg_replace('/[^a-z0-9 \-]+/i', '', $s);
-
Jun 19, 2007, 08:08 #5
thanks!
Bookmarks