Hi!
What is your issue with the script?
In the first case, you'll need some code like
In the second case, you need to identify what to replace and by which new text. According to your example, this could beuse FileHandle; my $htmlfile = new FileHandle("XXX.html", "r") ; while ($line = <$htmlfile>) { # process each line
Then you'll need to create the perl-regExes for replacing ... using =~ s/// and escaping all special characters. One line could be<a class= ----> <div class="main-button-wrapper"><a class= or <\a> ----> <\a><\div>
$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
In reply to Re: Search and replace HTML
by Ratazong
in thread Search and replace HTML
by PerlRob
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |