On Fri, 2006-30-06 at 23:04 +0200, Filip Jursik wrote: > Hi, > > this > > $text = "first first second third"; > $text =~ /(first.*?third)/; > print $1; > > gives me > > "first first second third" > > as a result instead of expected > > "first second third" > > What am I doing wrong? I've expected the .*? to limit the wildcard only to > the > string " second ".
You mean something like this? #!/usr/bin/perl use strict; use warnings; my $text = "first first second third"; $text =~ /(?:first.*)(first.*third)/; print $1, "\n"; -- __END__ Just my 0.00000002 million dollars worth, --- Shawn "For the things we have to learn before we can do them, we learn by doing them." Aristotle * Perl tutorials at http://perlmonks.org/?node=Tutorials * A searchable perldoc is at http://perldoc.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>