On the web pages of the site there are links to archives to download the file.
Links of this type:
<a title="" href="http://site.ru/downloads/soft.zip">bestsoft</a> It is necessary after each such link to insert an HTML tag, for example <hr /> . Those. after the closing tag </a> tag should be <hr /> .
Here's how:
<a title="" href="http://site.ru/downloads/soft.zip">bestsoft</a><hr /> What did I do:
I found such links on web pages by file extension, regular.
$html = preg_replace('/<a[^>]+.zip[^"]*">(.*?)<\/a>$/', '<hr />', $html); return $html; But the links were replaced by the <hr /> .
Question:
What is the correct code that will add the HTML tag immediately after the links to the archive with the .zip, .rar, .7-zip file extension?
preg_replace('~<a\s[^>]+\.zip[^"]*">.*?</a>$~', '$0<hr />', $html);- Wiktor Stribiżew$text = preg_replace('/<a[^>]+.zip[^"]*">(.*?)<\/a>/', '$0<hr />', $text);it is possible instead of a slash tilde. Almost broke his head on the regular season. Also, the editor automatically puts the br tag before hr. Thank. - Viher