regex - Conversion of ereg_replace to preg_replace, PHP 5,3 -


for changing php 5,3 ... not sure if can change function name in below ereg_replace preg_replace - if result in same or if syntax has changed regarding "[\n\r]" og "\t\t+" - can tell me sure (very hard test in given setup environment)...

$line2 = ereg_replace("[\n\r]", "", $line);  $line2 = ereg_replace("\t\t+", "", $line2); 

thanks in advance...

the given examples should work this:

$line2 = preg_replace("/[\n\r]/", "", $line);  $line2 = preg_replace("/\t\t+/", "", $line2); 

in cases need other modifications, too. example if used / inside regex need escape this: \/

please read thread: ereg_replace preg_replace?


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -