»Rasmus Lerdorf« sagte am 2002-03-18 um 07:12:21 -0800 :
> $new = preg_replace('/[^a-z]/i','',$old);
> Note that this will also get rid of the - in this case since you
> specifically asked for something that got rid of everything not a-z

Yes.  And to not get rid of the -, you need to specify it as the 1st
charcter, or in your case, as the 2nd:

$new = preg_replace('/[^-a-z]/i','',$old);

How do you allow [ and ]?

$new = preg_replace('/[^[]-a-z]/i','',$old);

Alexander Skwar
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:       http://www.iso-top.de      |     Jabber: [EMAIL PROTECTED]
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
                       Uptime: 1 day 4 hours 22 minutes

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to