STOPATDESK YES;
:: TXT "LCLLMT:29.4700";
:: TXT "LCLCURR;NON-USD";
:: TXT "CALLBK:3";
:: TXT "FFTRL:EUR-LIM;-TAP-5";
STOPATDESK YES; :: TXT "LCLLMT:29.4700"; :: TXT "LCLCURR;NON-USD"; :: TXT "CALLBK:3"; :: TXT "FFTRL:EUR-LIM;-TAP-5";
请问你能提供匹配分号的正则表达式而不是TXT“......”吗?
StackOverflow上有几个有用的问题但是我没能为我的案例编译工作解决方案
Regex for matching a character, but not when it's enclosed in square bracket
Regex for matching a character, but not when it's enclosed in quotes
答案 0 :(得分:2)
你需要一个匹配任何分号后面没有奇数引号的正则表达式。
;(?![^"]*(([^"]*"[^"]*"){2})*[^"]*"[^"]*$)
棘手的部分是找到negative lookahead (?![^"]*(([^"]*"[^"]*"){2})*[^"]*"[^"]*$)
:
[^"]*
匹配"
;
之前的任何文字
(([^"]*"[^"]*"){2})*
匹配[^"]*"[^"]*$
匹配最后一个引用如果满足上述所有条件,则在"
之后找到奇数个;
。这意味着;
位于两个"
内,因此它不是有效的;
。
正则表达式:https://regex101.com/r/dG6cC1/1
Java演示:https://ideone.com/OuAaA5
答案 1 :(得分:0)