SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Nov 19, 2007, 12:57 #1
- Join Date
- Sep 2003
- Location
- USA
- Posts
- 47
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
$5 paypal to the person that can solve this super easy regex problem
Probably through preg_replace, I need help creating a function that removes all characters in a string excluding the following characters: a-z 0-9 space
Example:
$string = 'hello & wo^^rld $ #__sig@@n says% hi!!!
tes*ti@@ng 012__3
n**#)@ow';
output should be:
hello world sign says hi
testing 0123
now
-
Nov 19, 2007, 12:59 #2
- Join Date
- Feb 2007
- Location
- UK
- Posts
- 591
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
preg_replace('~[^0-9a-zA-Z ]~', '', $text);
-
Nov 19, 2007, 13:07 #3
- Join Date
- Sep 2003
- Location
- USA
- Posts
- 47
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
pm me your paypal address, that worked perfectly thanks
Bookmarks