Home  >  Article  >  Backend Development  >  []正则怎么获取文件中的JS数组

[]正则怎么获取文件中的JS数组

WBOY
WBOYOriginal
2016-06-13 12:38:34854browse

[求助]正则如何获取文件中的JS数组
有一个需求,读取一个文件抓取文件中的JS数组。
用该正则句仅能抓取到一个值  Array\(.+?\);

而且php中没有仅获取匹配后的数组,所以考虑用 preg_replace 方法将除我想要的数据之外其他数据全部替换掉,最后仅留我需要的部分。

但不知道怎么实现,麻烦大家帮忙咯。

正则裁切文件 php 数组 JS
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn