Regexp: How to do this...

V

vendredi5h

Hello all,

I would like to create a Regexp that (very simplified situation) read a
web page and retreive some informations in the table rows (<tr>) that
include a particular text except if it include too another particular
text.

Say I've got the following variable:

var myhtml = "
<table>
<tr><th>Name</th><th>Mathematics</th><th>Geography</th><th>History</th></tr>
<tr><td>Bob</td><td>85</td><td>65</td><td>92</td></tr>
<tr><td>Eve</td><td><span
class="bad">42</span></td><td>78</td><td>88</td></tr>
<tr><td>Joe</td><td>85</td><td>96</td><td><span
class="bad">74</span></td></tr>
<tr><td>Flo</td><td>32</td><td>85</td><td>85</td></tr>
<tr><td>Aly</td><td>96</td><td>77</td><td>91</td></tr>
</table>
";

It represents some school results (a totaly fictive exemple! So please
don't give solution so solve this precise case.). I'd like to get the
name of the students that get at least one score >= 90 but didn't get
any score considered as "bad". In this situation, the result would be:
["Bob", "Aly"].

Is there a way to do this using Regexp? In the real situation, each
<tr>..</tr> can include one or many line feed ("\n") and can have
between say 50 and 500 chars.

Thanks for your time and your brain! :eek:)

Yannick
 
V

vendredi5h

Jim Land (NO SPAM) a écrit :
Come, come. In a table, each tr is for one row. How can you expect to
parse a table structure that doesn't adhere to the rules of table
structure?

What?! I do not understand your point.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,187
Latest member
RosaDemko

Latest Threads

Top