You are here: Re: [PHP] Regular expressions « PHP « IT news, forums, messages
Re: [PHP] Regular expressions

Posted by "Gustav Wiberg" on 10/09/05 22:59

----- Original Message -----
From: "Jasper Bryant-Greene" <jasper@bryant-greene.name>
To: "PHP General" <php-general@lists.php.net>
Sent: Sunday, October 09, 2005 8:06 PM
Subject: Re: [PHP] Regular expressions


> Gustav Wiberg wrote:
>> <?php
>> $lines = file('export/nhExportVarupiraten.txt');
>>
>> // Loop through our array, show HTML source as HTML source; and line
>> numbers too.
>> foreach ($lines as $line_num => $line) {
>>
>> echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br
>> />\n";
>>
>> if ($line_num > 0 ) {
>> $getName = explode('<>', $line);
>> $pattern = "/ID=([0-9]*)\</";
>> $subject = $line;
>> $idNumber = preg_split($pattern, $subject);
>
> // instead of preg_split, use preg_match
>
> $idNumber = preg_match($pattern, $subject, $matches);
>
> // your ID number is now in $matches[1]
>
>>
>> echo "NAME = " . $getName[2] . " has ID number=$idNumber[0]<br>";
>> }
>> //require("phpfunctions/opendb.php");
>> //$sql = "UPDATE beskrivandeVarunamn=" . safeQuote($bNamn) . " WHERER"
>> //mysql_close();
>>
>> }
>>
>> ?>
>
> --
> Jasper Bryant-Greene
> Freelance web developer
> http://jasper.bryant-greene.name/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.11.13/124 - Release Date:
> 2005-10-07
>
>
Hi there!

Thanx, I'll try that! :-)

/G
http://www.varupiraten.se/

 

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

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