What are the rules for which urls to remove/keep?
Mar 21, 2022
17
Level 1
How can I remove a link from php
am having a text that contains several urls. But I want to strip of specific url and keep others. Considering the text below, how can I remove the url "https://opportunitydesk.org/2022/03/16/marilyn-stafford-fotoreportage-award-2022/" from the text and maintain the rest? Am using laravel 8.
Consider this text
<p>Applications are open for the <a href="https://opportunitydesk.org/2022/03/16/marilyn-stafford-fotoreportage-award-2022/">Marilyn Stafford FotoReportage Award 2022</a>. The Award, facilitated by FotoDocument and supported by Nikon, is granted annually to a professional women photographer towards the completion of a compelling and cohesive documentary photo essay which addresses an important social, environmental, economic or cultural issue, whether local or global.</p>
<p><strong><a href="https://fotodocument.org/wp-content/uploads/MSFA-APPLICATION-FORM-2022.docx" target="_blank" rel="noreferrer noopener nofollow">Click here to download the application form</a></strong></p>
<p>For more information, visit <strong><a href="https://fotodocument.org/fotoaward/" target="_blank" rel="noreferrer noopener nofollow">FotoReportage Award</a>.</strong></p>
Level 102
@isaacongoma Something like
$replaced = preg_replace('/(<a.*https:\/\/opportunitydesk\.org.*<\/a>)/', '', $string);
Please or to participate in this conversation.