【发布时间】:2021-05-02 07:39:25
【问题描述】:
我正在尝试使用 preg_match 在 .txt 文件中搜索一个短语,但它从来没有给我匹配。奇怪的是,如果我尝试在沙箱中复制和粘贴文件内容,我会得到很好的匹配。这是我尝试过的:
$txtUrl='https://www.sec.gov/Archives/edgar/data/1411579/000110465920131796/0001104659-20-131796.txt';
$getTextS3 = file_get_contents($txtUrl, true);
$str=strip_tags($getTextS3);
$re = '/Shares of Class A common stock/i';
preg_match_all($re, $str, $match);
var_dump($match);
【问题讨论】:
-
你能给我们一个你正在搜索的文本样本吗?
标签: php regex file search preg-match-all