I never thought I'd see MBF and JLH mentioned in the same breath...
#!/usr/bin/perl use strict; use warnings; use diagnostics; use Data::Dumper; my $html = '<TABLE width=468 style="border-collapse:collapse"> <TR><TD><TABLE width=468 style="border-collapse:collapse" cellpadding= +2> <TR><TD class=head>Artist</TD><TD class=head>Song</TD></TR> <TR class=g><TD class=i><A href="/my-bloody-valentine-rxzg3.html">My B +loody Valentine</A></TD><TD class=j><A href="/my-bloody-valentine-lov +ely-sweet-darlene-9lgrnkb.html">Lovely Sweet Darlene *</A></TD></TR> <TR class=h><TD class=i><A href="/jennifer-love-hewitt-d193f.html">Jen +nifer Love Hewitt</A></TD><TD class=j><A href="/jennifer-love-hewitt- +i-want-a-love-i-can-see-jv2mj67.html">I Want A Love I Can See *</A></ +TD></TR> <TR class=g><TD class=i><A href="/jennifer-love-hewitt-d193f.html">Jen +nifer Love Hewitt</A></TD><TD class=j><A href="/jennifer-love-hewitt- +no-ordinary-love-4rftntr.html">No Ordinary Love *</A></TD></TR>'; my @data = (); while ( $html =~ m|<TD class=\w><A href="([^"]+)">([^<]+)</A></TD>|g ) { push( @data, { link => $1, name => $2 } ); } print Dumper(\@data); #### result #### # $VAR1 = [ # { # 'link' => '/my-bloody-valentine-rxzg3.html', # 'name' => 'My Bloody Valentine' # }, # { # 'link' => '/my-bloody-valentine-lovely-sweet-darlene-9lgrnkb.ht +ml', # 'name' => 'Lovely Sweet Darlene *' # }, # { # 'link' => '/jennifer-love-hewitt-d193f.html', # 'name' => 'Jennifer Love Hewitt' # }, # { # 'link' => '/jennifer-love-hewitt-i-want-a-love-i-can-see-jv2mj6 +7.html', # 'name' => 'I Want A Love I Can See *' # }, # { # 'link' => '/jennifer-love-hewitt-d193f.html', # 'name' => 'Jennifer Love Hewitt' # }, # { # 'link' => '/jennifer-love-hewitt-no-ordinary-love-4rftntr.html' +, # 'name' => 'No Ordinary Love *' # } # ]; #
($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
=~y~b-v~a-z~s; print
In reply to Re^3: multiple regex matching
by Cody Pendant
in thread multiple regex matching
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |