You are here: Re: regex help « PHP Programming Language « IT news, forums, messages
Re: regex help

Posted by John Dunlop on 10/09/56 11:44

basement_addict@yahoo.com:

> I am trying to remove all the headers in a text file.
>
> I tried this preg_replace('/^.*\n/', '',$body) but it only removed the
> first one.

It matches up to the first line-feed character. You want it to match
up to the first occurrence of two consecutive line-feeds (the first two
consecutive carriage-return/line-feed pairs, \r\n\r\n, perhaps?).
Remember the s modifier so that the dot matches any single line-feeds.

HTH.

--
Jock

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация