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!
)
Yannick
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!
Yannick