Re: Regular expressions
| From: | Gustav Wiberg | Date: | Sun, 09 Oct 2005 19:59:41 +0000 |
| Subject: | Re: Regular expressions | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-223792@lists.php.net to get a copy of this message | ||
----- 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:Thanx, I'll try that! :-) /G http://www.varupiraten.se/<?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!