Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在努力弄清楚拆分此字符串的正确正则表达式是什么:
[ABC]!=[BCD]=
进入这个拆分结果:
我实际的正则表达式模式是:
(?<=!=|=)|(?=!=|=)
但我得到的结果是:
请帮忙!
这要简单得多:
splitArray = Regex.Split(subjectString, "(!?=)");
给你["[ABC]", "!=", "[BCD]", "="]。
["[ABC]", "!=", "[BCD]", "="]
使用这个正则表达式(!=)|(=)|(\[.*?\])
(!=)|(=)|(\[.*?\])