import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(?<! {5})(\\\".+?\\\": [^\\\\[\\{\\n]+(?:,|\\n))|(?<! {5})(\".+?\": \\{[\\S\\s]+?\\},)|(?<! {5})(\".+?\": \\[[\\S\\s]+?\\],)";
final String string = "{\n"
+ " \"applicationId\": \"id651979466\",\n"
+ " \"lastestVersion\": \"19.10.03\",\n"
+ " \"originalUrlBottomTitle\": \"Nguồn <publisherName>\",\n"
+ " \"titleUpdate\": \"Bạn đã sử dụng phiên bản cũ!!!\",\n"
+ " \"messageUpdate\": \"Hãy cập nhật ứng dụng để trải nghiệm các tính năng mới, hấp dẫn.\",\n"
+ " \"linkUpdate\": \"https://itunes.apple.com/app/id651979466\",\n"
+ " \"introduce\": {\n"
+ " \"title\": \"Đối tác chính thức\",\n"
+ " \"introduceURL\": \"https://app.baomoi.com/publisher/list\"\n"
+ " },\n"
+ " \"buttonYes\": \"Cập nhật\",\n"
+ " \"buttonNo\": \"Để sau\",\n"
+ " \"statusUpdate\": 0,\n"
+ " \"enableParse\": true,\n"
+ " \"enableCrashlytics\": true,\n"
+ " \"livescoreUrl\": \"https://baomoi.com/soccer/app\",\n"
+ " \"commentCollapseMin\": 7,\n"
+ " \"shareZalo\": true,\n"
+ " \"loginFacebook\": false,\n"
+ " \"shareFacebook\": true,\n"
+ " \"shareFacebookMess\": true,\n"
+ " \"zal\": true,\n"
+ " \"zalInterval\": 259200,\n"
+ " \"userLoZalInterval\": 86400,\n"
+ " \"show_comment_time_limit\": 86400,\n"
+ " \"enableWebm\": true,\n"
+ " \"enableRenderAvatarUserName\": true,\n"
+ " \"avatarDefaultNames\": [\n"
+ " \"default\"\n"
+ " ],\n"
+ " \"logArticles\": 3,\n"
+ " \"logVideos\": 2,\n"
+ " \"show_feed_article_des\": false,\n"
+ " \"inapp_noti_default_headline\": \"Báo Mới\",\n"
+ " \"QoSLogReqLimit\": 50,\n"
+ " \"QoSLogTimeLimit\": 0,\n"
+ " \"QoSLogTimeLimitImages\": 0,\n"
+ " \"impsLogTime\": 1000,\n"
+ " \"impsLogSize\": 20,\n"
+ " \"impsPollLogSize\": 1,\n"
+ " \"timeReloadAds\": 5,\n"
+ " \"defaultMode\": 0,\n"
+ " \"defaultModeTablet\": 0,\n"
+ " \"defaultModeIP5\": 1,\n"
+ " \"maxArticles\": 1000,\n"
+ " \"maxVideos\": 200,\n"
+ " \"maxHotComments\": 3,\n"
+ " \"timeReloadApp\": 1800,\n"
+ " \"smallPreset\": \"a300,w200_r4x3,a400x\",\n"
+ " \"mediumPreset\": \"a400,w200_r4x3,a500x\",\n"
+ " \"largePreset\": \"a500,w300_r4x3,a700x\",\n"
+ " \"iPadPreset\": \"a700,w400_r4x3,a800x\",\n"
+ " \"iPX_listArticleFontSize\": \"18,20,22\",\n"
+ " \"iPX_feedArticleFontSize\": \"18,20,22\",\n"
+ " \"iPX_listTitleFontSize\": 17,\n"
+ " \"iPX_feedTitleFontSize\": 19,\n"
+ " \"iP6_listArticleFontSize\": \"18,20,22\",\n"
+ " \"iP6_feedArticleFontSize\": \"18,20,22\",\n"
+ " \"iP6_listTitleFontSize\": 18,\n"
+ " \"iP6_feedTitleFontSize\": 20,\n"
+ " \"iP6P_listArticleFontSize\": \"18,20,22\",\n"
+ " \"iP6P_feedArticleFontSize\": \"18,20,22\",\n"
+ " \"iP6P_listTitleFontSize\": 18,\n"
+ " \"iP6P_feedTitleFontSize\": 20,\n"
+ " \"iPad_listArticleFontSize\": \"22,24,26\",\n"
+ " \"iPad_feedArticleFontSize\": \"24,26,28\",\n"
+ " \"iPad_listTitleFontSize\": 24,\n"
+ " \"iPad_feedTitleFontSize\": 26,\n"
+ " \"iP5_listArticleFontSize\": \"18,20,22\",\n"
+ " \"iP5_feedArticleFontSize\": \"20,22,24\",\n"
+ " \"iP5_listTitleFontSize\": 18,\n"
+ " \"iP5_feedTitleFontSize\": 22,\n"
+ " \"pageRequestCounter\": 15,\n"
+ " \"showCounter\": true,\n"
+ " \"showLastestNewsButton\": true,\n"
+ " \"showSlideBanner\": false,\n"
+ " \"videoFormat\": 0,\n"
+ " \"allowPreloadVideo\": true,\n"
+ " \"wifi_chunkPreloadVideo\": 1,\n"
+ " \"3g_chunkPreloadVideo\": 0,\n"
+ " \"commentHints\": \"Bình luận phải có ít nhất 3 chữ|Bình luận phải dùng tiếng Việt có dấu.|Bình luận không nói tục, chửi bậy.|Bình luận không chứa liên kết, quảng cáo.\",\n"
+ " \"feedName\": \"Theo dõi\",\n"
+ " \"feedThumbURL\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/AppFeedThumb/feedthumb1.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/AppFeedThumb/feedthumb2.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/AppFeedThumb/feedthumb3.jpg\"\n"
+ " ],\n"
+ " \"feedEmptyScreenMsg\": \"Theo dõi thêm nguồn \\nđể có thêm tin trong danh sách\",\n"
+ " \"defaultZoneNewsTab\": \"c_0\",\n"
+ " \"fixedZones\": \"Tin nóng|c_0,Tin mới|c_-1\",\n"
+ " \"defaultZones\": \"Bóng đá VN|c_87,Bóng đá QT|c_86,Độc & Lạ|c_79,Tình yêu|c_139,Giải trí|c_52,Thế giới|c_119,Pháp luật|c_58,Xe 360|c_145,Công Nghệ|c_53,Ẩm thực|c_84,Làm đẹp|c_138,Sức khỏe|c_82,Du lịch|c_137\",\n"
+ " \"allZones\": \"Tin mới|c_-1,Bóng đá VN|c_87,Bóng đá QT|c_86,Độc & Lạ|c_79,Tình yêu|c_139,Giải trí|c_52,Thế giới|c_119,Pháp luật|c_58,Xe 360|c_145,Công Nghệ|c_53,Ẩm thực|c_84,Làm đẹp|c_138,Sức khỏe|c_82,Du lịch|c_137,Nhà đất|c_147,Thời sự|c_144,Thiết bị - Phần cứng|c_136,Kinh tế|c_45,Giáo dục|c_59,Không gian - Kiến trúc|c_150,Thời trang|c_72\",\n"
+ " \"updatedZones\": \"Bóng đá VN|c_87\",\n"
+ " \"excludedZones\": \"\",\n"
+ " \"changedZones\": \"k_Biển Đông|top_228,st_5|top_228\",\n"
+ " \"regions\": \"Hà Nội|r_Hà Nội|29,TP. HCM|r_TP. HCM|50,An Giang|r_An Giang|67,Bắc Giang|r_Bắc Giang|98,Bắc Kạn|r_Bắc Kạn|97,Bạc Liêu|r_Bạc Liêu|94,Bắc Ninh|r_Bắc Ninh|99,Bến Tre|r_Bến Tre|71,Bình Định|r_Bình Định|77,Bình Dương|r_Bình Dương|61,Bình Phước|r_Bình Phước|93,Bình Thuận|r_Bình Thuận|86,BR-VT|r_BR-VT|72,Cà Mau|r_Cà Mau|69,Cần Thơ|r_Cần Thơ|65,Cao Bằng|r_Cao Bằng|11,Đà Nẵng|r_Đà Nẵng|43,Đăk Lăk|r_Đăk Lăk|47,Đăk Nông|r_Đăk Nông|48,Điện Biên|r_Điện Biên|27,Đồng Nai|r_Đồng Nai|60,Đồng Tháp|r_Đồng Tháp|66,Gia Lai|r_Gia Lai|81,Hà Giang|r_Hà Giang|23,Hà Nam|r_Hà Nam|90,Hà Tĩnh|r_Hà Tĩnh|38,Hải Dương|r_Hải Dương|34,Hải Phòng|r_Hải Phòng|15,Hậu Giang|r_Hậu Giang|95,Hòa Bình|r_Hòa Bình|28,Hưng Yên|r_Hưng Yên|89,Khánh Hòa|r_Khánh Hòa|79,Kiên Giang|r_Kiên Giang|68,Kon Tum|r_Kon Tum|82,Lai Châu|r_Lai Châu|25,Lâm Đồng|r_Lâm Đồng|49,Lạng Sơn|r_Lạng Sơn|12,Lào Cai|r_Lào Cai|24,Long An|r_Long An|62,Nam Định|r_Nam Định|18,Nghệ An|r_Nghệ An|37,Ninh Bình|r_Ninh Bình|35,Ninh Thuận|r_Ninh Thuận|85,Phú Thọ|r_Phú Thọ|19,Phú Yên|r_Phú Yên|78,Quảng Bình|r_Quảng Bình|73,Quảng Nam|r_Quảng Nam|92,Quảng Ngãi|r_Quảng Ngãi|76,Quảng Ninh|r_Quảng Ninh|14,Quảng Trị|r_Quảng Trị|74,Sóc Trăng|r_Sóc Trăng|83,Sơn La|r_Sơn La|26,Tây Ninh|r_Tây Ninh|70,Thái Bình|r_Thái Bình|17,Thái Nguyên|r_Thái Nguyên|20,Thanh Hóa|r_Thanh Hóa|36,Tiền Giang|r_Tiền Giang|63,Trà Vinh|r_Trà Vinh|84,TT Huế|r_TT Huế|75,Tuyên Quang|r_Tuyên Quang|22,Vĩnh Long|r_Vĩnh Long|64,Vĩnh Phúc|r_Vĩnh Phúc|88,Yên Bái|r_Yên Bái|21\",\n"
+ " \"domainIcon\": \"https://baomoi-static.zadn.vn/icon_publishers\",\n"
+ " \"topPublishers\": \"VietnamNet|p_23,Tiền Phong|p_20,VTC News|p_83,Zing|p_119,VOV|p_65,VietnamPlus|p_293,PLO|p_114,Infonet|p_240\",\n"
+ " \"defaultVideoZones\": [\n"
+ " {\n"
+ " \"zoneName\": \"Mới\",\n"
+ " \"zoneId\": \"v_-1\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/New/v_-1_1_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/New/v_-1_2_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/New/v_-1_3_20181031.jpg\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"zoneName\": \"Ahihi\",\n"
+ " \"zoneId\": \"v_12\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Ahihi/v_12_1_20181031_fixed.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Ahihi/v_12_2_20181031_fixed.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Ahihi/v_12_3_20181031_fixed.jpg\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"zoneName\": \"OMG\",\n"
+ " \"zoneId\": \"v_47\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/OMG/v_47_1_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/OMG/v_47_2_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/OMG/v_47_3_20181031.jpg\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"zoneName\": \"2Tek\",\n"
+ " \"zoneId\": \"v_43\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Hightek/v_43_1_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Hightek/v_43_2_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Hightek/v_43_3_20181031.jpg\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"zoneName\": \"Bóng đá\",\n"
+ " \"zoneId\": \"v_21\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/BongDa/v_21_1_20181108.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/BongDa/v_21_2_20181108.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/BongDa/v_21_3_20181108.jpg\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"zoneName\": \"Cute\",\n"
+ " \"zoneId\": \"v_40\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Cute/v_40_1_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Cute/v_40_2_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Cute/v_40_3_20181031.jpg\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"zoneName\": \"Showbiz\",\n"
+ " \"zoneId\": \"v_6\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Showbiz/v_6_1_20181226.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Showbiz/v_6_2_20181226.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Showbiz/v_6_3_20181226.jpg\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"zoneName\": \"Sống\",\n"
+ " \"zoneId\": \"v_37\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Ngam/v_37_1_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Ngam/v_37_2_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Ngam/v_37_3_20181031.jpg\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"zoneName\": \"Lifestyle\",\n"
+ " \"zoneId\": \"v_16\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/LifeStyle/v_16_1_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/LifeStyle/v_16_2_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/LifeStyle/v_16_3_20181031.jpg\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"zoneName\": \"News\",\n"
+ " \"zoneId\": \"v_1\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/News/v_1_1_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/News/v_1_2_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/News/v_1_3_20181031.jpg\"\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"zoneName\": \"Top\",\n"
+ " \"zoneId\": \"v_0\",\n"
+ " \"images\": [\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Top/v_0_1_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Top/v_0_2_20181031.jpg\",\n"
+ " \"https://baomoi-static.zadn.vn/Uploaded/VideoSubTabImgs/Top/v_0_3_20181031.jpg\"\n"
+ " ]\n"
+ " }\n"
+ " ],\n"
+ " \"pubProfileTabsName\": \"1|Tổng hợp,9|Video,13|Poll,15|Q&A\",\n"
+ " \"logChannels\": 2,\n"
+ " \"maxChannelContents\": 10,\n"
+ " \"channelFontSize\": \"13,14,14\",\n"
+ " \"articleVideoMode\": 1,\n"
+ " \"articleViewMode\": 1,\n"
+ " \"tapForSoundShowingTime\": 1,\n"
+ " \"tapForSoundText\": \"Bấm video để mở tiếng\",\n"
+ " \"numberOfInsertedArticles\": 3,\n"
+ " \"recommendListRefreshInterval\": 1800000,\n"
+ " \"showRecommendGroup\": false,\n"
+ " \"recommendGroupName\": \"CÓ THỂ BẠN QUAN TÂM\",\n"
+ " \"recommendGroupBtnText\": \"Xem thêm\",\n"
+ " \"suggestReplyCondition\": 3,\n"
+ " \"hideArticleReasonsDefault\": \"Bạo lực|content,Đồi trụy|content,Phản cảm|content,Xuyên tạc|content,Kỳ thị địa phương|content\",\n"
+ " \"popupHideArticleMsg\": \"Vui lòng chọn các nguyên nhân khiến bạn không thích bài viết này để chúng tôi có thể đề xuất tin cho bạn tốt hơn\",\n"
+ " \"reportArticleReasons\": \"Tin gốc đã gỡ|original_removed,Tin gốc đã cập nhật|original_updated,Bạo lực|content,Đồi trụy|content,Phản cảm|content,Xuyên tạc|content,Kỳ thị địa phương|content,Ý kiến khác...|other\",\n"
+ " \"popupReportArticleMsg\": \"Vui lòng chọn các nguyên nhân bạn muốn báo cáo nội dung bài viết này\",\n"
+ " \"reportVideoReasons\": \"Tin gốc đã gỡ|original_removed,Tin gốc đã cập nhật|original_updated,Bạo lực|content,Đồi trụy|content,Phản cảm|content,Xuyên tạc|content,Kỳ thị địa phương|content,Ý kiến khác...|other\",\n"
+ " \"popupReportVideoMsg\": \"Vui lòng chọn các nguyên nhân bạn muốn báo cáo nội dung video này\",\n"
+ " \"reportCommentReasons\": \"Bạo lực|comment,Đồi trụy|comment,Phản cảm|comment,Xuyên tạc|comment,Kỳ thị địa phương|comment,Spam|comment,Ý kiến khác...|other\",\n"
+ " \"popupReportCommentMsg\": \"Vui lòng chọn các nguyên nhân báo xấu bình luận này của người dùng %s\",\n"
+ " \"stepToShowTripleCell\": 0,\n"
+ " \"appNavBarBg\": \"https://baomoi-static.zadn.vn/Uploaded/Bao_BD/nav_bar_bg_default@3x.png\",\n"
+ " \"nativeAdsReportMessage\": \"Chúng tôi sẽ cố gắng hạn chế hiển thị quảng cáo này đến bạn.\",\n"
+ " \"nativeAdsReportPopupMsg\": \"Vui lòng chọn các nguyên nhân báo xấu quảng cáo này\",\n"
+ " \"articleVideoAutoPlay\": true,\n"
+ " \"listVideoAutoPlay\": true,\n"
+ " \"listVideoAutoPlayNext\": true,\n"
+ " \"listTopCmtArticleCondition\": \"50,200,500\",\n"
+ " \"replyLoadMoreAmount\": 10,\n"
+ " \"articleTopCommentGroup\": true,\n"
+ " \"coverageEnable\": true,\n"
+ " \"articleCmtBoxHiddenEnable\": true,\n"
+ " \"articleViewCloseBtnCondition\": 2,\n"
+ " \"sectionBoxesEnable\": [\n"
+ " 0,\n"
+ " 1,\n"
+ " 2,\n"
+ " 3,\n"
+ " 4,\n"
+ " 10,\n"
+ " 11,\n"
+ " 20,\n"
+ " 30,\n"
+ " 40\n"
+ " ],\n"
+ " \"content_type\": {\n"
+ " \"article\": [\n"
+ " 1\n"
+ " ],\n"
+ " \"video\": [\n"
+ " 9\n"
+ " ],\n"
+ " \"topic\": [\n"
+ " 5,\n"
+ " 6,\n"
+ " 7\n"
+ " ],\n"
+ " \"qaQuestion\": [\n"
+ " 15\n"
+ " ],\n"
+ " \"qaAnswer\": [\n"
+ " 16\n"
+ " ],\n"
+ " \"poll\": [\n"
+ " 13\n"
+ " ],\n"
+ " \"comment\": [\n"
+ " 18\n"
+ " ]\n"
+ " },\n"
+ " \"qaHistorySize\": 40\n"
+ " }";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html