tcorbeil Posted March 28, 2007 Share Posted March 28, 2007 Hello again. Someone gave me this script to replace special characters from a variable with "_".. $Subpage = ereg_replace("[^[:alpha:]]", "_", $Subpage); problem is that it also replaces numbers.. so if i have "$Subpage="Nintendo 64"; after $Subpage = ereg_replace("[^[:alpha:]]", "_", $Subpage); i would get a value of Nintendo___.. I would like to achieve a value of Nintendo_64.. Any advise would be much appreciated.. T. Quote Link to comment Share on other sites More sharing options...
Orio Posted March 28, 2007 Share Posted March 28, 2007 Try: $Subpage = preg_replace("/[^a-z0-9]/i", "_", $Subpage); Orio. Quote Link to comment Share on other sites More sharing options...
WhatWhat Posted March 28, 2007 Share Posted March 28, 2007 You can just replace "alpha" with "alnum". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.