On Feb 3, 2008 8:00 PM, LKSunny <[EMAIL PROTECTED]> wrote:
> <?
> $txt = <<<eof
> aaaaaaaaa
> aaaaaaaaa
> aaaaaaaaa
>
> bbbbbbbb
> bbbbbbbb
>
> bbbbbbbb
> eof;
>
> //i just want replace "start to first \r\n\r\n"
> //how can i do ?
[snip]

<?
$txt = <<<eof
aaaaaaaaa
aaaaaaaaa
aaaaaaaaa

bbbbbbbb
bbbbbbbb

bbbbbbbb
eof;

$rep = preg_replace('/^(?s)(.*)(\r)?\n(\r)?\n/U','',$txt);

echo $rep."\n";
?>

    Note the optional \r and required \n.  This is because, if the
input/output is ever touching a non-Windows machine, it won't use \r\n
for newlines - only \n.

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

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

Reply via email to