News Howardz wrote:
>
The original mail is regarded as a SPAM by Yahoo -- poor regex match :-(.
So I modify the following content and resend it.
================================
Sorry, I make a mistake in the mail below:
$str = "...<script>xxx</script>zzz<script>y222yy</script>...";
I want to match the script section containing "222".
So I wrote regex like this:
/(<script>.*?222.*?<\/script>)/
But it doesn't work.
It still selects the 2 script sections:
"<script>xxx</script>zzz<script>y222yy</script>".
Does anyone have an idea how to achieve this?
Is this what you want? It will find the /last/ occurrence of the script
section containing 222.
Rob
use strict;
use warnings;
my $str = "...<script>xxx</script>zzz<script>y222yy</script>...";
$str =~ /.*(<script>.*?222.*?<\/script>)/;
print $1;
**OUTPUT**
<script>y222yy</script>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/