不在双引号之间时选择 WORD 的正则表达式

RegEx for selecting WORD when it's not between double-quotes

当 'and' 不在双引号之间时,选择 'and' 的适当正则表达式 ( javascript ) 是什么。 如下所示:

def abc as "Hello and Welcome" and aaa as "Hi" and bbb as "and"

"and"不包括在双引号中的应该选择如下:

def abc as "Hello and Welcome" and aaa as "Hi" and bbb as "and"

谢谢

试试这个,效果很好

and(?=[^"]*("[^"]*"[^"]*)*$)

它假定如果 and 之后有成对的双引号,那么这个 and 不在双引号中。

演示看看here