Re: [PHP] about preg_replace, please help !

2008-02-04 Thread Daniel Brown
On Feb 3, 2008 8:00 PM, LKSunny [EMAIL PROTECTED] wrote:
 ?
 $txt = eof
 a
 a
 a

 
 

 
 eof;

 //i just want replace start to first \r\n\r\n
 //how can i do ?
[snip]

?
$txt = eof
a
a
a





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



[PHP] about preg_replace, please help !

2008-02-03 Thread LKSunny
?
$txt = eof
a
a
a





eof;

//i just want replace start to first \r\n\r\n
//how can i do ?
//i want out put
/*




*/
print preg_replace(What's is this ?, , $txt);

//Thank You !!
? 

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



Re: [PHP] about preg_replace, please help !

2008-02-03 Thread Casey

On Feb 3, 2008, at 5:00 PM, LKSunny [EMAIL PROTECTED] wrote:


?
$txt = eof
a
a
a





eof;

//i just want replace start to first \r\n\r\n
//how can i do ?
//i want out put
/*




*/
print preg_replace(What's is this ?, , $txt);

//Thank You !!
?

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



list(, $result) = explode(\r\n\r\n, $string, 2);

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



Re: [PHP] about preg_replace, please help !

2008-02-03 Thread Casey
On Feb 3, 2008 9:04 PM, LKSunny [EMAIL PROTECTED] wrote:
 this i know.
 but i need use preg_replace.

 any body can help me, thank you very much !!

 Casey [EMAIL PROTECTED]
 ???:[EMAIL PROTECTED]

  On Feb 3, 2008, at 5:00 PM, LKSunny [EMAIL PROTECTED] wrote:
 
  ?
  $txt = eof
  a
  a
  a
 
  
  
 
  
  eof;
 
  //i just want replace start to first \r\n\r\n
  //how can i do ?
  //i want out put
  /*
  
  
 
  
  */
  print preg_replace(What's is this ?, , $txt);
 
  //Thank You !!
  ?
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  list(, $result) = explode(\r\n\r\n, $string, 2);

 --

Why do you need preg_replace?

-- 
-Casey

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



Re: [PHP] about preg_replace, please help !

2008-02-03 Thread LKSunny
this i know.
but i need use preg_replace.

any body can help me, thank you very much !!

Casey [EMAIL PROTECTED] 
???:[EMAIL PROTECTED]
 On Feb 3, 2008, at 5:00 PM, LKSunny [EMAIL PROTECTED] wrote:

 ?
 $txt = eof
 a
 a
 a

 
 

 
 eof;

 //i just want replace start to first \r\n\r\n
 //how can i do ?
 //i want out put
 /*
 
 

 
 */
 print preg_replace(What's is this ?, , $txt);

 //Thank You !!
 ?

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


 list(, $result) = explode(\r\n\r\n, $string, 2); 

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



Re: [PHP] about preg_replace, please help !

2008-02-03 Thread Paul Scott

On Sun, 2008-02-03 at 21:06 -0800, Casey wrote:

 Why do you need preg_replace?
 

Else he fails a homework assignment?

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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