In what way is it "without success"? Is the "+" character being taken out (I assume this is what you mean)? Are other characters being taken out that you want left in or left in that you want taken out?
Perhaps showing us a bit more of the code that calls this function might help, as well as some examples of what you are feeding in and getting/wanting out.
On the face of it, whatever string is in $name_delimiter should replace every non-alphanumeric except the "+" character in $name just as you want.However the operation of this function is dependent on what $name and $name_delimiter are and you have not told us that.
The only comment I'd make is that the "+" within the character set definition looses its "normal" meaning as a quantifier and does not need to be escaped.
Susan