正则表达式表格数据转为数组
来源:互联网 发布:北京炸酱面知乎 编辑:程序博客网 时间:2024/06/06 18:27
function
get_td_array(
$table
) {
$table
= preg_replace(
"'<table[^>]*?>'si"
,
""
,
$table
);
$table
= preg_replace(
"'<tr[^>]*?>'si"
,
""
,
$table
);
$table
= preg_replace(
"'<td[^>]*?>'si"
,
""
,
$table
);
$table
=
str_replace
(
"</tr>"
,
"{tr}"
,
$table
);
$table
=
str_replace
(
"</td>"
,
"{td}"
,
$table
);
//去掉 HTML 标记
$table
= preg_replace(
"'<[/!]*?[^<>]*?>'si"
,
""
,
$table
);
//去掉空白字符
$table
= preg_replace(
"'([rn])[s]+'"
,
""
,
$table
);
$table
= preg_replace(
'/ /'
,
""
,
$table
);
$table
=
str_replace
(
" "
,
""
,
$table
);
$table
=
str_replace
(
" "
,
""
,
$table
);
$table
=
explode
(
'{tr}'
,
$table
);
array_pop
(
$table
);
foreach
(
$table
as
$key
=>
$tr
) {
$td
=
explode
(
'{td}'
,
$tr
);
array_pop
(
$td
);
$td_array
[] =
$td
;
}
return
$td_array
;
}
0 0
- 正则表达式表格数据转为数组
- 正则表达式转为javascript脚本
- 正则表达式 符号表格
- re2c - 将正则表达式转为c代码
- 包装类、String转为int、正则表达式
- js数组、正则表达式
- 对象 数组 正则表达式
- 正则表达式:如何查找数组
- 将xls表格数据转为点数据(1)
- 将xls表格数据转为点数据(2)
- 正则表达式,数据整理
- C# 数据集转为JSON数组
- 正则表达式语法(有表格)
- 正则表达式的语法(有表格)
- 正则表达式语法(有表格)
- PHP相关系列 - 正则表达式表格
- HTML用正则表达式检验表格
- 正则表达式去掉word转为html后的垃圾样式
- MyEclipse10插件安装(二)
- UIView加边框及边框颜色
- 第三章第十五题
- ZOJ Problem Set - 1048||Financial Management
- 打印输出后不占位置的字符串--特殊的三个字节组合。
- 正则表达式表格数据转为数组
- 环境配置问题与解决方案:VMWare 10 安装CentOS6.6 时自动进入text mode
- apt-get是debian,ubuntu发行版的包管理工具,与红帽中的yum工具非常类似。 apt-get命令一般需要root权限执行,所以一般跟着sudo命令。 例:sudo apt-get xx
- Android Bitmap那些事之如何优化内存
- Android开发实战之与JAVA开发对比
- 浅谈CSRF攻击方式
- POJ3648.Wedding——2-sat输出任意解
- 引用与指针
- 【linux】mm内存管理