Regex matching EOL character within a string
I'm trying to find LF characters that appear between double quotes. The text file I'm searching has field-value pairs in this format
msgid "text 1"
msg开发者_JAVA百科str "text 2"
I'm trying to find if LF characters appear within text 1 or text 2 strings. I have tried "[^"\r\n]*\n[^"\r\n]*"
but it just picks up " msgstr "
This regex :
if ($subject =~ m/"([^"\r\n]*?[\r\n]+[^"\r\n]*?)"\s*$/m) {
$result = $1;
}
When applied to these strings :
msgid "text 1 "
msgstr "text 2"
msgstr "something with new
line"
Will produce this output :
something with new
line
精彩评论