使用regex从巨大的html表中查找某些td值
Find certain td values from huge table html using regex
我需要为大块html编写一个正则表达式。
<td width=342 align=left style='width:256pt'> HF Acciones Lideres - Clase G</td><td width=24 align=center style='width:18pt'>ARS </td><td width=24 align=center style='width:18pt'>Arg </td><td width=24 align=center style='width:18pt'>Lar </td><td width=60 align=center style='width:45pt'>08/10/14</td><td width=88 align=right style='width:64pt'>1738.383</td><td width=83 align=right style='width:62pt'>51,427,906</td><td width=83 align=right style='width:62pt'>89,401,382</td>
只有当第一个td是HF Acciones Lideres-Clase G.时,我才需要获得日期(08/10/14)和值(1738.383)
请参阅(注意:regexr不允许保存完整的html,所以我将放在这里):http://regexr.com/3alo4
完成htmlhttp://fondosargentina.org.ar/scripts/cf_EstadisticaDiariaAntDetalle.asp?Fecha=08/10/14&Clasi_Id=00001
您可以使用jQuery搜索方法找到这些值:
$(document).ready(function() {
var $tr = $("td:contains('Lideres - Clase G')").parent();
var date = "";
var total = "";
$tr.children("td").each(function(i) {
if (i==4) date = $(this).text();
if (i==5) total = $(this).text();
});
alert("date="+ date + ", total=" +total);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table border=1 cellpadding=0 cellspacing=0 width=728 style="font-family: Arial; font-size: 8 pt; position: absolute; left: 25; table-layout:fixed; width:546">
<tr height=17>
<td width=342 align=left style='width:256pt'> 1810 Renta Variable Argentina</td>
<td width=24 align=center style='width:18pt'>ARS </td>
<td width=24 align=center style='width:18pt'>Arg </td>
<td width=24 align=center style='width:18pt'>Lar </td>
<td width=60 align=center style='width:45pt'>08/10/14</td>
<td width=88 align=right style='width:64pt'>13905.228</td>
<td width=83 align=right style='width:62pt'>2,866,017</td>
<td width=83 align=right style='width:62pt'>39,852,620</td>
</tr>
<tr height=17>
<td width=342 align=left style='width:256pt'> 1822 Raices Valores Negociables</td>
<td width=24 align=center style='width:18pt'>ARS </td>
<td width=24 align=center style='width:18pt'>Arg </td>
<td width=24 align=center style='width:18pt'>Lar </td>
<td width=60 align=center style='width:45pt'>08/10/14</td>
<td width=88 align=right style='width:64pt'>139941.375</td>
<td width=83 align=right style='width:62pt'>297,644</td>
<td width=83 align=right style='width:62pt'>41,652,710</td>
</tr>
<tr height=17>
<td width=342 align=left style='width:256pt'> AL Renta Variable - Clase A</td>
<td width=24 align=center style='width:18pt'>ARS </td>
<td width=24 align=center style='width:18pt'>Arg </td>
<td width=24 align=center style='width:18pt'>Lar </td>
<td width=60 align=center style='width:45pt'>08/10/14</td>
<td width=88 align=right style='width:64pt'>5047.820</td>
<td width=83 align=right style='width:62pt'>277,968</td>
<td width=83 align=right style='width:62pt'>1,403,133</td>
</tr>
<tr height=17>
<td width=342 align=left style='width:256pt'> AL Renta Variable - Clase B</td>
<td width=24 align=center style='width:18pt'>ARS </td>
<td width=24 align=center style='width:18pt'>Arg </td>
<td width=24 align=center style='width:18pt'>Lar </td>
<td width=60 align=center style='width:45pt'>08/10/14</td>
<td width=88 align=right style='width:64pt'>5704.307</td>
<td width=83 align=right style='width:62pt'>3,655,663</td>
<td width=83 align=right style='width:62pt'>20,853,021</td>
</tr>
<tr height=17>
<td width=342 align=left style='width:256pt'> AL Renta Variable II - Clase A</td>
<td width=24 align=center style='width:18pt'>ARS </td>
<td width=24 align=center style='width:18pt'>Arg </td>
<td width=24 align=center style='width:18pt'>Lar </td>
<td width=60 align=center style='width:45pt'>03/09/12</td>
<td width=88 align=right style='width:64pt'>1604.331</td>
<td width=83 align=right style='width:62pt'>8,658</td>
<td width=83 align=right style='width:62pt'>13,890</td>
</tr>
<tr height=17>
<td width=342 align=left style='width:256pt'>HF Acciones Lideres - Clase G</td>
<td width=24 align=center style='width:18pt'>ARS </td>
<td width=24 align=center style='width:18pt'>Arg </td>
<td width=24 align=center style='width:18pt'>Lar </td>
<td width=60 align=center style='width:45pt'>08/10/14</td>
<td width=88 align=right style='width:64pt'>1738.383</td>
<td width=83 align=right style='width:62pt'>51,427,906</td>
<td width=83 align=right style='width:62pt'>89,401,382</td>
</tr>
</table>
相关文章:
- 查找所有TD标签并读取其数据属性
- 使用regex从巨大的html表中查找某些td值
- 在 jquery 中的 TR 中查找 td 的所有输入
- jQuery选择器,用于查找包含具有特定值的TD输入的TR
- 在td旁边的HTML表中查找td文本
- 如何使用 jQuery 筛选器选择器查找表标记 td 值
- 在指定的td中查找输入字段的特定值
- 循环通过表格查找第一个具有 CSS CSSstablelisttdselect 的 TD 文本
- 正在查找表行中的td元素位置
- Javascript:遍历对象数组以查找键值对并将它们呈现在表中 td
- 为其中一个单元格或 td 查找 colSpan 标头是 Spans
- 按行索引查找一行,然后在jquery中查找特定的td
- 函数在td元素中查找不起作用的文本
- 使用Jquery可以查找父表、表或td
- javascript查找html<tr>具有类并且具有嵌套<td>
- 查找父兄弟td隐藏值
- 使用jquery查找同级td元素
- 在元素中查找最近的td
- 在表中查找TD的位置
- 如何使用jquery查找td:conths(textbox)的最小值