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.
我正在尝试从当前字符串中获取值:
String s = "%5B%22VALUE1%22%2C+%22VALUE2.com%22%5D";
我正在使用:
Regex rgx = new Regex("%.*?22");
这给出了以下内容:
VALUE1 VALUE2.com 5D
由于我是使用正则表达式的新手,我很想得到一些帮助。有人可以告诉我如何摆脱它5D吗?
5D
提前致谢
怎么样:
Regex rgx = new Regex("%.*?(?:22|$)");
使用前瞻确保22遵循:
22
Regex rgx = new Regex("%(?=.*?22).*?22");