Regex to match nested json objects
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm implementing some kind of parser and I need to locate and deserialize json object embedded into other semi-structured data . I used regexp: \\{\\s*title.*?\\} to locate object {title:'Title'} but it doesn't work with nested objects because expression matches only first found closing curly bracket. For {title:'Title',{data:'Data'}} it matches {title:'Title',{data:'Data'} so string becomes invalid for deserialization. I understand that there's a greedy business coming into account but I'm not familiar with regexps. Could you please help me