Posted by David Haynes on 10/21/10 11:43
d wrote:
> "Rex" <eric.fiori@gmail.com> wrote in message
> news:1143445129.437173.181710@t31g2000cwb.googlegroups.com...
>> I believe you want to read the file line by line and then try and match
>> your regex to each line. try:
>>
>> $handle = @fopen("dummy.txt", "r");
>> if ($handle) {
>> while (!feof($handle)) {
>> $buffer = fgets($handle);
>> if( !preg_match('/^b.*?\n/',$buffer) )
>> echo $buffer . "<br>";
>> }
>> fclose($handle);
>> }
>
> You could use substr($buffer, 0, 1)=="b" as opposed to preg_match, as
> preg_match is a bit more intensive than just substr...
>
>
or just $buffer[0]...
-david-
[Back to original message]
|