Answer the question
In order to leave comments, you need to log in
How to defeat srt_replace?
Greetings, there is an html page, it is necessary to cut off all links leading to 404 from it, I decided to use str_replace, but for some reason it does not work, what is the reason, who will tell you?)
The code that should be deleted
$html = file_get_contents("D:/OpenServer/domains/nfp/blog/index.html");
$replace = str_ireplace("/<a(.*?)\/blog6\/find_a_job\/index\.html(.*?)<\/a>/", "anykeyword", $html);
echo $replace;
<li class="page_item page-item-1383"><a href="/blog/find_jobs/index.html" title="<a href="http://site.org/blog6/find-a-job/">Find Jobs</a>"><a href="/blog6/find_a_job/index.html">Find Jobs</a></a></li>
Answer the question
In order to leave comments, you need to log in
what is the reasonMainly because str_replace() doesn't work with regular expressions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question