in reply to Re: Changing quoted strings spanning more than one line
in thread Changing quoted strings spanning more than one line

Unfortunately, it fails with the new test data (see root node update above). To clarify, if you run it with:

hello "" bill hello " " bill
it produces:
hello "" bill hello " " bill
when it should not alter the input data in this case.

Replies are listed 'Best First'.
Re^3: Changing quoted strings spanning more than one line
by BrowserUk (Patriarch) on Sep 19, 2007 at 06:55 UTC

    Tad more complicated:

    $_ = do{ local $/; <DATA> }; s[("[^\n"]*?")|("[^\n"]+?\n[^"]+?")][ ##" $1 || do{ (my $x = $2) =~ s[\s+][ ]g; $x } ]ge; print; "boom" hello "" bill hello " " bill "baz hello jock" "boom2" abc "baz2 hello2 jock2 "

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.