On 25 Feb 2001 10:34:27 -0800, Jeff Oien <[EMAIL PROTECTED]> wrote:
>I would like to get rid of \n characters unless there
>are two or more in a row. So for example if there
The Perl-compatible regular expressions support lookahead and look behind:
$str = 'abcdefabcaadd';
echo "$str\n";
$str = preg_replace("/(?<!a)a(?!a)/", "-", $str);
echo "$str\n";
will display this:
abcdefabcaadd
-bcdef-bcaadd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]