in reply to Search and replace HTML

Hi!

What is your issue with the script?

In the first case, you'll need some code like

use FileHandle; my $htmlfile = new FileHandle("XXX.html", "r") ; while ($line = <$htmlfile>) { # process each line
In the second case, you need to identify what to replace and by which new text. According to your example, this could be
<a class= ----> <div class="main-button-wrapper"><a class= or <\a> ----> <\a><\div>
Then you'll need to create the perl-regExes for replacing ... using =~ s/// and escaping all special characters. One line could be
$line =~ s/<\/a>/<\/a><\/div>/;

HTH, Rata

PS.: be aware that defining suitable patterns for your anchor-tags is crucial, as the solution above is just a text-replace, but is not working on the HTML-structure. If your HTML-pages contain your anchors at "unexpected" places, you'll probably be much happier by using a CPAN-module for HTML-parsing