| 
	
 | 
 Posted by Erwin Moller on 06/13/75 11:43 
Geoff Berrow wrote: 
 
> 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>" : ""; 
> } 
> ?> 
 
Personally I prefer non-regex solutions too. 
Regex is ok as long as I am able to read what it says, and the bigger  
complex regex always give me headaches. :P 
 
Regards, 
Erwin Moller
 
  
Navigation:
[Reply to this message] 
 |