Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
But the .*? always gobbles up the trailing " and the \"? never matches it. I thought non-gready .* matched as few non-newline characters as possible. Why is it matching the final " if it could leave it for "? and the pattern would still match?my $string = '"foo"'; $string =~ s/\"(.*?)\"?/$1/; print $string;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching quote characters?
by liverpole (Monsignor) on Aug 05, 2006 at 15:31 UTC | |
|
Re: Matching quote characters?
by Leviathan (Scribe) on Aug 05, 2006 at 14:13 UTC | |
|
Re: Matching quote characters?
by betterworld (Curate) on Aug 05, 2006 at 19:19 UTC | |
|
Re: Matching quote characters?
by rodion (Chaplain) on Aug 05, 2006 at 14:25 UTC | |
by betterworld (Curate) on Aug 05, 2006 at 19:22 UTC | |
|
Re: Matching quote characters?
by TedPride (Priest) on Aug 06, 2006 at 22:02 UTC |