07-20-2009, 03:14 PM
|
#5 (permalink)
|
|
The Contributor
Join Date: Apr 2008
Posts: 78
Thanks: 0
|
Thanks for the suggestions but they don't seem to be working. I changed the input string to more properly illustrate the problem. So given this string
PHP Code:
$str = '#!$abstract modern-fields';
it should output If I use this
PHP Code:
echo ereg_replace("[^[:alpha:],[:digit:],_,[:blank:]]","",$str).'<br>';
It displays And if I use this
PHP Code:
ereg_replace("[[!-@],[:punct:]]","",$str).'<br>';
It displays
Quote:
|
#!$abstract modern-fields
|
The #!S are all listed as characters in :punct: so those should be stripped. The first method does that but it also removes the hyphen. The second doesn't remove the punctuation but handles the hyphen correctly. Would someone point out my mistake, please?
|
|
|
|