You want to look at the /s switch on the s/// operator. For instance, with the following code (in a one-liner with -l):
my $str = q{this is "a test}
. qq{\n}
. q{this is "only a "poor "test};
print $str;
print qq{=====};
$str =~ s/"[^"]+"//gs;
print $str;
I get the following result, which is similar to what you indicated you needed:
this is "a test
this is "only a "poor "test
=====
this is only a test
Hope that helps.
Update: 2011-03-09
I cannot help but second roboticus's references and suggestions. There is much useful information (and I now have another module to take a look at when I have "spare" time available again). :)
Update: 2011-03-09
It appears as if the module in question may be YAPE::Regex::Explain (as I found when I tried installing it to play with it myself).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|