plznty Posted April 8, 2011 Share Posted April 8, 2011 How can I make it so only A-Z and 0-9 "-" "@" "," "."s work and the rest of the characters are deleted from my string/variable. Quote Link to comment https://forums.phpfreaks.com/topic/233110-strip-characters-from-a-variable/ Share on other sites More sharing options...
dcro2 Posted April 8, 2011 Share Posted April 8, 2011 $string = preg_replace("/[^a-z0-9-@,.]/i", "", $string); Quote Link to comment https://forums.phpfreaks.com/topic/233110-strip-characters-from-a-variable/#findComment-1198868 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.