Regex 正则表达式查找有错误引号的行
嗨,我需要帮助找到一行有错误引号Regex 正则表达式查找有错误引号的行,regex,quotation-marks,Regex,Quotation Marks,嗨,我需要帮助找到一行有错误引号 1 "many word " "many word" "many word " 2 "many word " " <-Error quotation 3 "many word " "many word " " many word " " many word " " &
1 "many word " "many word" "many word "
2 "many word " " <-Error quotation
3 "many word " "many word " " many word " " many word " " <-Error quotation
4 """ but this quotation not match
5 "\"" this is not match
6 " aasd \" " " <-Error quotation \"
only line 2 3 6 have an error quotation
i need to find a line have an error quotation by regex
1“多字”“多字”“多字”
2“多词”使用
^[^”\n]*(?:“”“|”[^\\\n”]*(?:\\.\\.^\\\n”]*)*“[^”\n]*)*+”
看
解释
--------------------------------------------------------------------------------
^ the beginning of the string
--------------------------------------------------------------------------------
[^"\n]* any character except: '"', '\n' (newline)
(0 or more times (matching the most amount
possible))
--------------------------------------------------------------------------------
(?: group, but do not capture (0 or more times
(matching the most amount possible)):
--------------------------------------------------------------------------------
""" '"""'
--------------------------------------------------------------------------------
| OR
--------------------------------------------------------------------------------
" '"'
--------------------------------------------------------------------------------
[^\\\n"]* any character except: '\\', '\n'
(newline), '"' (0 or more times
(matching the most amount possible))
--------------------------------------------------------------------------------
(?: group, but do not capture (0 or more
times (matching the most amount
possible)):
--------------------------------------------------------------------------------
\\ '\'
--------------------------------------------------------------------------------
. any character except \n
--------------------------------------------------------------------------------
[^\\\n"]* any character except: '\\', '\n'
(newline), '"' (0 or more times
(matching the most amount possible))
--------------------------------------------------------------------------------
)* end of grouping
--------------------------------------------------------------------------------
" '"'
--------------------------------------------------------------------------------
[^"\n]* any character except: '"', '\n'
(newline) (0 or more times (matching the
most amount possible))
--------------------------------------------------------------------------------
)*+ end of grouping (possessive match, no backtracking)
您好,您能帮我修复第4行吗?第4行是正确的。这是一个特殊情况,它有3个引号。谢谢