我想按照以下方案使用正则表达式在引号内选择文本 -
正则表达式应该在引号之间选择文本 . 如果有嵌套引号,则应选择所有内部嵌套引号而不是外部引号 .
前1 - Sample.text.value "The quick brown fox"
结果应该是 - The quick brown fox
前2 - Sample.text.value "The quick brown fox" random text here one "jumps over the lazy dog" random text here two
结果应为 - The quick brown fox 和 jumps over the lazy dog
前3 - "Sample.text.value "The quick brown fox" random text here one "jumps over the lazy dog" random text here two"
结果应为 - The quick brown fox 和 jumps over the lazy dog
我正在尝试这个正则表达式 "([^"]*)"
这在前两种情况下工作正常 . 但在第三种情况下,它没有按预期选择 .
它选择 Sample.text.value 和 random text here one 和 random text here two .
但我需要选择 The quick brown fox 和 jumps over the lazy dog .
是否可以通过正则表达式?
1 回答
检查下一个正则表达式
(?m)(?!^)\"((?:(?!\").)*)\"
.要在线试用正则表达式并获得解释,请单击here .