RE: [PHP] Real world regex

From: Date: Mon, 04 Mar 2002 17:10:29 +0000
Subject: RE: [PHP] Real world regex
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-87128@lists.php.net to get a copy of this message
-----Original Message----- From: Bas Jobsen [mailto:bas@startpunt.cc] Sent: Monday, March 04, 2002 8:55 AM To: Craig Westerman; php-general-list Subject: Re: [PHP] Real world regex > For another I need to get the 3rd opening table row <tr> tag after the 7th > opening <table> tag. not tested: "(<table[^>]+>.*){6}(<table[^>]+>)([ ]*)(<tr[^>]*>)(.*){2}(<tr[^>]*>)(.*)" ------------------------- Bas, Thanks for the reply. I can easily grab this test page http://www.gold-forum.com/table.html using this script. (shown below) http://www.gold-forum.com/grab2.php When I try replacing $GrabStart = "<body>"; with your $GrabStart = "(<table[^>]+>.*){6}(<table[^>]+>)([ ]*)(<tr[^>]*>)(.*){2}(<tr[^>]*>)(.*)"; I get errors. If you have time, can you show me what I need for: $GrabStart = "???"; //3rd opening table row <tr> tag after the 7th opening <table> tag $GrabEnd = "???"; //3rd closing table row <tr> tag after the 7th closing <table> tag Thanks Craig ><> westerman@chanuteks.com ------------code start------------- <html> <head> <title>Grab 2 Example</title> </head> <body> <? $GrabURL = "http://www.gold-forum.com/table.html"; $GrabStart = "<body>"; //need 3rd opening table row <tr> tag after the 7th opening <table> tag $GrabEnd = "</body>"; //need 3rd closing table row <tr> tag after the 7th closing <table> tag $file = fopen("$GrabURL", "r"); $rf = fread($file, 200000); $grab = eregi("$GrabStart(.*)$GrabEnd", $rf, $printing); fclose($file); echo $printing[1]; ?> </body> </html>

« previous php.general (#87128) next »