[PHP] Regular Expression by Exception

2008-08-04 Thread Alberto García Gómez

Fellows:

If I use ereg_replace($params, $string) I can replace the char that match 
with $params in the $string.


BUT, how I can replace ALL chars EXCEPT the chars in $params.

Something like !$params, I think 




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



Re: [PHP] Regular Expression by Exception

2008-08-04 Thread Micah Gersten
I don't know how to use the POSIX classes, but if you use preg_replace:
preg_replace(/[^$params]/, '', $string);

I think this will work.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Alberto García Gómez wrote:
 Fellows:

 If I use ereg_replace($params, $string) I can replace the char that
 match with $params in the $string.

 BUT, how I can replace ALL chars EXCEPT the chars in $params.

 Something like !$params, I think



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