Dennis G. Wicks wrote:
Greetings;
I have a file of 100+ records like the following. I hope the line wrap
doesn't mess things up too much.
<a href="http://www.ten.com/" target="_blank">|<img src="/022.jpg"
border="0"></a>| ,<a href="http://www.ten.com/" target="_blank"><font
size="1">|Link Text Message|</font></a>
<---------------------($1)------------------->|<-------------($2)---------------->|<---------------------------------($3)------------------------>|<------($4)----->|<<trash>>>>
I have inserted | where I want to split them and indicated by <--($n)-->
below the record what var I think they will go to.
I want to reformat them as $1$4$2 so they look like this:
<a href="http://www.ten.com/" target="_blank">Link Text Message<img
src="/022.jpg" border="0"></a>
s#^(.+?)(<img.+?</a>).+?<font.+?>([^<]+).*#$1$3$2#
I am having no luck at all. Here is my last attempt, which produces no
change at all!!
perl -i -p -e 's/^([^<img]+)(<img.+\/a> )(,.+1\">)(.+<)/$1$4$2/' FHG.tst
Among other things you need to read up on character classes. They deal
with characters, not strings.
Does the file only consist of such records, one on each line, and with
identical markup? If not, trying to do it with one substitution is a
crazy idea. If it's a real world thing, you most likely should use an
HTML parser.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/