Re: preg_match(_all) confusion
- From: trookat <trookat@xxxxxxxxxxxxx>
- Date: Thu, 05 Feb 2009 07:45:00 +0900
Zacariaz wrote:
Ok, so I usually just look at the manual, but this time I simply don't
understand the content. It's embaresing really.
Anyway, the problem is real simple. I grap some source:
#
$ch = curl_init("****");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
#
This works fine, though I'm not sure it the best way of doing it, but
for now that's not important.
In this source I know there is some very specific html tags, which I
need to get the contents of. The tags are:
<TD COLSPAN="5">content</TD>
<TD ALIGN="RIGHT" COLSPAN="2">content</TD>
I figure I need to use preg_match or preg_match_all, but I'll be
damned if I understand how they work.
Well, I hope you will spend a few minutes on a desperate retard.
Regards
hi Zacariaz,
I took me a good part of a year to under stand simple syntax of regular expressions, I recommend that you get your self a copy of "Mastering Regular Expressions" http://oreilly.com/ .
you need to something like this
"/\<TD COLSPAN=\"5\">([^\<])\<\/TD\>/"
"/<TD ALIGN=\"RIGHT\" COLSPAN=\"2\">([^\<]+)\<\/TD\>/"
I would suggest that you use preg_match_all.
I hope that gets your started.
I'm sure if I made any mistakes the guys here will jump in with corrections .
regards
trookat
.
- Follow-Ups:
- Re: preg_match(_all) confusion
- From: Zacariaz
- Re: preg_match(_all) confusion
- References:
- preg_match(_all) confusion
- From: Zacariaz
- preg_match(_all) confusion
- Prev by Date: Re: MySQL newb question...
- Next by Date: Re: MySQL newb question...
- Previous by thread: preg_match(_all) confusion
- Next by thread: Re: preg_match(_all) confusion
- Index(es):
Relevant Pages
|