括号写错了,正则更正为如下,就可以了: \b(endfunction|endtask)(\s*:\s*(\w+))?\b我已经测试过了
"^(AF){1}$|^(AI){1}$|^(AM){1}$|^(AP){1}$|^(AR){1}$|^(B){1}$|^(B2){1}$|^(ISIN){1}$"