my $text = "Test of \"this first quote.\" Second quote \"ignored.\""; $text =~ s/\"(.*?)\"/\"that\"/; #### my $text = 'Test of "this first quote." Second quote "ignored."'; $text =~ s/"(.*?)"/"that"/;