Re: fopen and preg_match
| From: | Jason Wong | Date: | Mon, 17 Nov 2003 16:38:30 +0000 |
| Subject: | Re: fopen and preg_match | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169968@lists.php.net to get a copy of this message | ||
On Tuesday 18 November 2003 00:03, Chris Hayes wrote:
> At 15:07 17-11-03, you wrote:
> >I have a code that should fetch the information from another webpage. The
> >code find's the page, but I can't make it stop on </table> sign.
> >
> >preg_match("|<tr class=\"listRow2\"><td
> >class=\"listRow2\"><span
> >class=\"listIndex\">1.+\<\/table\>|is", $buffer, $regs );
>
> It probably looks for the last table tag. Is that so? Then you need to tell
> the script in a modifier that it should not be greedy (not my terminology,
> but the regexp term for this). The modifiers are the letters after the
> patern itself, in your example the i (do not make a difference between
> capital and small letters) and s ( I think: ignore line breaks). Try adding
> a U for making it non greedy. If that does not help check the docs on 'non
> greedy'.
Also, characters are being escaped unecessarily. The "table" fragment should
probably be simply:
</table>
ie no need to escape the forward slash (/) and the greater-than sign (>).
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
America!! I saw it all!! Vomiting! Waving! JERRY FALWELLING into
your void tube of UHF oblivion!! SAFEWAY of the mind ...
*/