|
Posted by Geoff Berrow on 10/04/45 11:43
Message-ID: <4427b828$0$11073$e4fe514c@news.xs4all.nl> from Erwin Moller
contained the following:
>Read this:
>http://nl3.php.net/manual/en/reference.pcre.pattern.modifiers.php
>
>So you could add the m modifier, like this:
>echo preg_replace('/^b.*\\n/m','',$contents);
>
>where:
>^b means begins with b
>.* means: anything untill end of line (\n) is reached
>\\n means the end of line
>and the m outside the // means that your string is treated the way you ment
>too (see description at www.php.net).
I really have to learn more about regex. In the meantime...
<?
$contents = file('dummy.txt');
foreach($contents as $value){
echo ($value{0}!="b")? $value."<br>" : "";
}
?>
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Navigation:
[Reply to this message]
|