User login

regular expressions

regex find-replace works in Skype on Mac and Linux

regex-style find replace - s/mistake/replacement/ - works in Skype on Mac and Linux for your previous message!

I'm not the first to discover this but discovering it by accident was fun!

Get rid of extra spaces using PHP's preg_replace

Right there in the examples for the php function preg_replace was how to strip whitespace from a string:

<?php
$str = preg_replace('/\s\s+/', ' ', $str);
?>

Ereg replace looks prettier:

<?php
$string = trim(ereg_replace(' +', ' ', $string));
?>

However, Agaric has read in several places that preg_replace tends to be faster.

Resolution

Syndicate content