Perl regular expressions normally match the longest string possible. that is what is called as "greedy match" For instance:my($text) = "mississippi";$text =~ m/(i.*s)/;print $1 . "
";Run the preceding code, and here's what you get:ississIt matches the first i, the last s, and everything in between them. But what if you want to match the first i to the s most closely following it? Use this code:my($text) = "mississippi";$text =~ m/(i.*?s)/;print $1 . "
";Now look what the code produces:is
If you have the better answer, then send it to us. We will display your answer after the approval.