Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试查找出现在双引号之间的 LF 字符。我正在搜索的文本文件具有这种格式的字段值对
msgid "text 1" msgstr "text 2"
我正在尝试查找 LF 字符是否出现在文本 1 或文本 2 字符串中。我试过"[^"\r\n]*\n[^"\r\n]*" 了,但它只是拿起" msgstr "
"[^"\r\n]*\n[^"\r\n]*"
" msgstr "
这个正则表达式:
if ($subject =~ m/"([^"\r\n]*?[\r\n]+[^"\r\n]*?)"\s*$/m) { $result = $1; }
当应用于这些字符串时:
msgid "text 1 " msgstr "text 2" msgstr "something with new line"
将产生这个输出:
something with new line