Re: Regular Exception - problem with preg match



kuka8 wrote:
> Hello Everybody !
>
> I need to parse a website, but I have a problem with preg_match
> function ,
>
> for example, i have a string ...
>
> $string = ' junk<table><b>BINGO</b></table>
> junk<table><b>bingo2</b></table>
> junk2<table><b>bingo3</b></table>';
>
> preg_match('|<table+*(.*)</table>+|sim', $string $r);
> echo $r[0];
> echo $r[1];
>
> is not working
>
> How to catch only bingo's ?
> I need only content of table tags as each element of array.

Try this:

preg_match_all('|<table[^>]*>(.*)</table>+|siU', $string, $r);


--
Justin Koivisto, ZCE - justin@xxxxxxxxx
http://koivi.com
.



Relevant Pages

  • Parsing CDATA section...HELP please!
    ... In VB I need to write some logic to make a call to a website and parse the ... return data which is in XML CDATA sections. ... Prev by Date: ...
    (microsoft.public.vb.general.discussion)
  • Re: Hostages Rescued. Liberals Will Be Outraged.
    ... transmitting rage. ... It's just a shame, however, that the group could not bring themselves to ... can read the group's website announcement here: ... And parse it as carefully as you might, you will not read one word ...
    (rec.sport.football.college)
  • which JAR to use ?
    ... i am looking for a third party JAR + API which will help me... ... though i can use HttpURLConnection class and send params to the website ... and parse the result, but this is tedious and i want to avoid this. ...
    (comp.lang.java.programmer)
  • Re: Format a field for Time, but as duration?
    ... which ONLY stores point-in-time data. ... total number of minutes") and parse it into hours/etc. ... for display purposes. ... Check the mvps.org/access website for additional ideas. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Hostages Rescued. Liberals Will Be Outraged.
    ... transmitting rage. ... It's just a shame, however, that the group could not bring themselves to ... can read the group's website announcement here: ... And parse it as carefully as you might, you will not read one word ...
    (rec.sport.football.college)