Web Analytics Made Easy -
StatCounter Remove special characters ( "£$%%^) and replace space with _ - CodingForum

Announcement

Collapse
No announcement yet.

Remove special characters ( "£$%%^) and replace space with _

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Remove special characters ( "£$%%^) and replace space with _

    Hey guys iv managed to remove all special characters froma string:

    PHP Code:
    $pass "'!£$%^&ss*()}{@:'#~/?><>/ 1 2 3 4 5 3/.,/:@/||\-=-__++-¬``1`sds";
    $pass preg_replace('/[^a-z0-9]/'''$pass); 
    But I want spaces to be replaced by _, but curently they are just removed all together.

    Thanks for you time.

  • #2
    PHP Code:
    preg_replace('/\s/''_'$text); 

    Comment

    Working...
    X