Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP & Regular Expressions

Status
Not open for further replies.

Meldric

MIS
Sep 5, 2001
139
US
I am trying to pull some data from a external webpage using a regular expression.

The url is:
and I am trying to pull the top 5 riders Names from the table.

The pattern I am using(for the first rider) is below:

Code:
$pattern = &quot;<TD>1.</TD>\n	<TD>(.*)</TD>\n	<TD>&quot;;

Which returns a parse error.
The code:

Code:
$pattern = &quot;<TD>1.</TD>(.*)<TD>2.</TD>;

returns all the information for one line so I think I am not detecting the whitespace correctly.

Can anyone help?

Roger
 
i don't know what are you using, i presume ereg.

When you do .* you mean every single character zero or more times.

One suggestion, is this (assuming that no horse name has a < in it)

change the (.*) by ([^<]*). This means everything but the minor signal.

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
i don't know what are you using, i presume ereg.

When you do .* you mean every single character zero or more times.

One suggestion, is this (assuming that no horse name has a < in it)

change the (.*) by ([^<]*). This means everything but the minor signal.


But you can still change a little to use preg. If so, use /pattern/sU to get what you want.

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
I tried the ([^/<]*). but it didn't work either. It just returned a space(no parse error though).

Any other ideas or someplace I should post this for further help?

Roger
 
try to use

preg_match(&quot;/<td>1\.</td>\n([ ]*)<td>(.*)</td>/sUi&quot;,$source,$array);
Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top