Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I know that there are a couple of CPAN modules which can do this but I thought it might be interesting to try myself first. I did try a lookahead and lookbehinds but it would only match the final string and not where the text is in a sentence. I'd be grateful for any pointers.use strict; use warnings; while (my $text = <DATA>) { if ($text =~ /(['"].*?['"])/ ){ print "Found $text \n"; } else { print "Out of luck \n"; } } __DATA__ "Mary and a little lamb", she said. She thought 'Hang on a tick' Nobody loves me "Mary and a large lamb"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to find all items in between quotation and speech marks
by kennethk (Abbot) on Jan 23, 2009 at 16:25 UTC | |
by Anonymous Monk on Jan 23, 2009 at 19:29 UTC | |
|
Re: Trying to find all items in between quotation and speech marks
by AnomalousMonk (Archbishop) on Jan 23, 2009 at 19:29 UTC | |
|
Re: Trying to find all items in between quotation and speech marks
by Marshall (Canon) on Jan 24, 2009 at 05:54 UTC | |
by AnomalousMonk (Archbishop) on Jan 24, 2009 at 19:25 UTC | |
by Marshall (Canon) on Jan 26, 2009 at 00:52 UTC | |
|
Re: Trying to find all items in between quotation and speech marks
by Anonymous Monk on Jan 23, 2009 at 16:16 UTC |