M
Marek Stepanek
Hallo all,
I try to set up a Perl-Filter (for BBEdit on Macintosh). I want to match and
print out all gifs needed for a rollover in an HTML-File. The filter should
match
onmouseover="document.podium.src='../../pix/grafix/hili_podium.gif';
but also beasts like the following :
onmouseover="document.podium.src='../../pix/logos/theembassy1.gif';
document.bios.src='../../pix/logos/theembassy2.gif';
document.addresses.src='../../pix/logos/theembassy3.gif';
document.events.src='../../pix/logos/theembassy4.gif';
document.priwat.src='../../pix/logos/theembassy5.gif';
document.yrpodium.src='../../pix/logos/theembassy6.gif';
document.logo.src='../../pix/logos/hili_pilogo.gif'"
the result should print from the above examples :
'../../pix/grafix/hili_podium.gif',
'../../pix/logos/theembassy1.gif',
'../../pix/logos/theembassy2.gif',
'../../pix/logos/theembassy3.gif',
'../../pix/logos/theembassy4.gif',
'../../pix/logos/theembassy5.gif',
'../../pix/logos/theembassy6.gif',
'../../pix/logos/hili_pilogo.gif',
I am labouring since a long while already on this filter. Could somebody
help me out ? I am beginner and want learn Perl very much.
This filter here produces the following error :
Modification of a read-only value attempted <> line 1.
(mind line breaks from my email client)
#!/usr/bin/perl -w
while (<>) {
($1, $2, $3) =
m!onmouseover="[^']+'([^']+)'(?
?
?:;\s+[^']+)'([^']+)')+)?(?
?:[^']+)'([
^']+)')?"!g;
my @results = ($1, $2, $3);
foreach $i (0..$#results) {
print "'", $i, "',\n";
}
}
My question is not about the grep search pattern, but how to put the
backreferences into an array to print it out.
one other try gives :
Use of uninitialized value in print <> line 2.
#!/usr/bin/perl -w
while (<>) {
while (
s!onmouseover="[^']+'([^']+)'(?
?
?:;\s+[^']+)'([^']+)')+)?(?
?:[^']+)'(
[^']+)')?"!!g ) {print "'", $1, "',\n"; print "'", $2, "',\n"; print "'",
$3, "',\n";}
}
thank you
marek
--
______________________________________________________________________
___PODIUM_INTERNATIONAL_//_the_embassy_for_talented_young_musicians___
_______Marek_Stepanek__mstep_[at]_PodiumInternational_[dot]_org_______
__________________http://www.PodiumInternational.org__________________
______________________________________________________________________
I try to set up a Perl-Filter (for BBEdit on Macintosh). I want to match and
print out all gifs needed for a rollover in an HTML-File. The filter should
match
onmouseover="document.podium.src='../../pix/grafix/hili_podium.gif';
but also beasts like the following :
onmouseover="document.podium.src='../../pix/logos/theembassy1.gif';
document.bios.src='../../pix/logos/theembassy2.gif';
document.addresses.src='../../pix/logos/theembassy3.gif';
document.events.src='../../pix/logos/theembassy4.gif';
document.priwat.src='../../pix/logos/theembassy5.gif';
document.yrpodium.src='../../pix/logos/theembassy6.gif';
document.logo.src='../../pix/logos/hili_pilogo.gif'"
the result should print from the above examples :
'../../pix/grafix/hili_podium.gif',
'../../pix/logos/theembassy1.gif',
'../../pix/logos/theembassy2.gif',
'../../pix/logos/theembassy3.gif',
'../../pix/logos/theembassy4.gif',
'../../pix/logos/theembassy5.gif',
'../../pix/logos/theembassy6.gif',
'../../pix/logos/hili_pilogo.gif',
I am labouring since a long while already on this filter. Could somebody
help me out ? I am beginner and want learn Perl very much.
This filter here produces the following error :
Modification of a read-only value attempted <> line 1.
(mind line breaks from my email client)
#!/usr/bin/perl -w
while (<>) {
($1, $2, $3) =
m!onmouseover="[^']+'([^']+)'(?
^']+)')?"!g;
my @results = ($1, $2, $3);
foreach $i (0..$#results) {
print "'", $i, "',\n";
}
}
My question is not about the grep search pattern, but how to put the
backreferences into an array to print it out.
one other try gives :
Use of uninitialized value in print <> line 2.
#!/usr/bin/perl -w
while (<>) {
while (
s!onmouseover="[^']+'([^']+)'(?
[^']+)')?"!!g ) {print "'", $1, "',\n"; print "'", $2, "',\n"; print "'",
$3, "',\n";}
}
thank you
marek
--
______________________________________________________________________
___PODIUM_INTERNATIONAL_//_the_embassy_for_talented_young_musicians___
_______Marek_Stepanek__mstep_[at]_PodiumInternational_[dot]_org_______
__________________http://www.PodiumInternational.org__________________
______________________________________________________________________