jockel has asked for the wisdom of the Perl Monks concerning the following question:
my $var = qq{onChange="[document.approveform.command.value='approve'; +document.approveform.submit();]" onClick="[if (this.disabled) {alert( +'some text!');}]"}; my ($onchange,$onclick); if ($var =~ /onChange/) { $var =~ /onChange\=\"\[(,*)\]\"/; $onchange = $1; } if ($var =~ /onClick/) { $var =~ /onClick\=\"\[(.*)\]\"/; $onclick = $1; } Results: >> $onchange = whole $var exept the start >> onChange="[ << and in the end >> ]" << >> $onclick = just the onClick part, just as it should be.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular expression problem
by davido (Cardinal) on Jun 09, 2004 at 08:16 UTC | |
by jockel (Beadle) on Jun 09, 2004 at 08:26 UTC | |
|
Re: Regular expression problem
by EdwardG (Vicar) on Jun 09, 2004 at 08:15 UTC | |
|
Re: Regular expression problem
by saskaqueer (Friar) on Jun 09, 2004 at 08:22 UTC | |
by jockel (Beadle) on Jun 09, 2004 at 09:05 UTC | |
by saskaqueer (Friar) on Jun 09, 2004 at 09:52 UTC | |
by jeffa (Bishop) on Jun 09, 2004 at 15:31 UTC |