且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java Regex 不一致组

更新时间:2023-02-26 11:29:27

(?<=[{,])\s*(.*?)(?=,|})

您可以简单地使用它并抓取捕获.参见演示.

You can simply use this and grab the captures.See demo.

https://regex101.com/r/sJ9gM7/33

当您有 (#something)* 时,正则表达式引擎只会记住最后一组.您不会以这种方式获得所有组.

When you have (#something)* then only the last group is remembered by the regex engine.You wont get all the groups this way.