【发布时间】:2018-04-21 14:52:29
【问题描述】:
我正在使用 pyqt 构建文本编辑器,我想在 (") 不以另一个 (") 结尾时设置字体 STYLES[error] ,并且当它正确结束时设置字体 STYLES[string] ,我的问题是当 (" ") 结束... ("") 之后的任何字符都采用字体 STYLES[error] 我想停止它但无法设置正确的正则表达式
`
STYLES = {
'string' : format('magenta') ,
'error' : format('red' , 'underline') ,
}
rules +=[(r'"[^"\\]*(\\.[^"\\]*)*', 0, STYLES['error']),
(r'"[^"\\]*(\\.[^"\\]*)*"', 0, STYLES['string']),]
`
【问题讨论】:
标签: python editor pyqt5 qregularexpression