hello friends i am new in php,

i tried a code to remove special characters into the string, i tried the following codes,,

$user = "some string here";
preg_match_all('/[^A-Z][^a-z_-][^0-9]/', $user, $result)

but the problem is that if i give the string like : name@#$@$# it also accepted buy the preg_match but i don't want accept any special character or space in to the string just (-_) will accepted....

Please help me to solve this problem...

i found the solution guys,

i have to use

preg_match_all('/[\s|\n|\t|@|#|$|%|&|*|=]/', $user, $result )

to match special characters and also spaces into the string
the string is $user


commented: Thanks for sharing +6