# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"\"listItems\"\s*:\s*([^}]+)"
test_str = ("\"listItems\": [\n"
" {\n"
" \"name\": \"Gelas Kaca Lusinan Murah 1 Set Isi 6 Motif Bening Model Klasik Unik Cafe Lucu Cantik Kedaung Coolant Tumblers Harga Murah Tidak Mudah Retak Pecah Bahan Beling Tebal Ukuran 250 ml elegan Untuk Tamu Rumah dan Dapur\",\n"
" \"nid\": \"5609668850\",\n"
" \"icons\": [],\n"
" \"image\": \"https://id-test-11.slatic.net/p/0227998499138451f7cc6ada1d885a7b.png\",\n"
" \"originalPrice\": \"35000.00\",\n"
" \"originalPriceShow\": \"Rp35.000\",\n"
" \"price\": \"29000.00\",\n"
" \"promotionId\": \"null\",\n"
" \"priceShow\": \"Rp29.000\",\n"
" \"discount\": \"-17%\",\n"
" \"ratingScore\": \"0\",\n"
" \"review\": \"\",\n"
" \"installment\": \"\",\n"
" \"tItemType\": \"nt_product\",\n"
" \"location\": \"Kota Surabaya\",\n"
" \"cheapest_sku\": \"5609668850_ID-11061072628\",\n"
" \"sku\": \"5609668850_ID\",\n"
" \"skus\": [],\n"
" \"brandId\": \"123222884\",\n"
" \"brandName\": \"KEDAUNG\",\n"
" \"sellerId\": \"400603179050\",\n"
" \"mainSellerId\": \"\",\n"
" \"sellerName\": \"Go-Panstore\",\n"
" \"thumbs\": [\n"
" {\n"
" \"image\": \"https://id-test-11.slatic.net/p/0227998499138451f7cc6ada1d885a7b.png\",\n"
" \"sku\": \"5609668850_ID\",\n"
" \"skuId\": \"11061072628\",\n"
" \"itemUrl\": \"/products/gelas-kaca-lusinan-murah-1-set-isi-6-motif-bening-model-klasik-unik-cafe-lucu-cantik-kedaung-coolant-tumblers-harga-murah-tidak-mudah-retak-pecah-bahan-beling-tebal-ukuran-250-ml-elegan-untuk-tamu-rumah-dan-dapur-i5609668850.html\"\n"
" }\n"
" ],\n"
" \"restrictedAge\": 0,\n"
" \"categories\": [\n"
" 16336,\n"
" 16358,\n"
" 16470\n"
" ],\n"
" \"clickTrace\": \"query:gelas+lucu+harga+murah;nid:5609668850;src:LazadaMainSrp;rn:c6e42d21e0c1c781d4df4ad08f2c5705;region:id;sku:5609668850_ID;price:29000.00;client:desktop;supplier_id:400603179050;asc_category_id:16470;item_id:5609668850;sku_id:11061072628;shop_id:2523734\",\n"
" \"addToCartSkus\": [\n"
" {\n"
" \"sku\": \"5609668850_ID-11061072628\",\n"
" \"skuId\": \"11061072628\",\n"
" \"count\": 0\n"
" }\n"
" ],\n"
" \"itemId\": \"5609668850\",\n"
" \"skuId\": \"11061072628\",\n"
" \"inStock\": true,\n"
" \"isAD\": 0,\n"
" \"addToCart\": false,\n"
" \"showFeedBack\": true,\n"
" \"longImageDisplayable\": false,\n"
" \"itemUrl\": \"//www.lazada.co.id/products/gelas-kaca-lusinan-murah-1-set-isi-6-motif-bening-model-klasik-unik-cafe-lucu-cantik-kedaung-coolant-tumblers-harga-murah-tidak-mudah-retak-pecah-bahan-beling-tebal-ukuran-250-ml-elegan-untuk-tamu-rumah-dan-dapur-i5609668850.html\",\n"
" \"querystring\": \"search=1\"\n"
" },\n"
" {\n"
" \"name\": \"Gelas Kaca Lusinan Murah 1 Set Isi 6 Motif Bening Model Cawan Unik Cafe Lucu Cantik Merk Kedaung Harga Murah Tidak Mudah Retak Pecah Bahan Beling Tebal Ukuran 250 ml elegan Untuk Tamu Rumah dan Dapur\",\n"
" \"nid\": \"5578244948\",\n"
" \"icons\": [],\n"
" \"image\": \"https://id-test-11.slatic.net/p/f3c88eb266396b1a132413af364c5e97.png\",\n"
" \"originalPrice\": \"35000.00\",\n"
" \"originalPriceShow\": \"Rp35.000\",\n"
" \"price\": \"25000.00\",\n"
" \"promotionId\": \"null\",\n"
" \"priceShow\": \"Rp25.000\",\n"
" \"discount\": \"-29%\",\n"
" \"ratingScore\": \"0\",\n"
" \"review\": \"\",\n"
" \"installment\": \"\",\n"
" \"tItemType\": \"nt_product\",\n"
" \"location\": \"Kota Surabaya\",\n"
" \"cheapest_sku\": \"5578244948_ID-11032256617\",\n"
" \"sku\": \"5578244948_ID\",\n"
" \"skus\": [],\n"
" \"brandId\": \"123222884\",\n"
" \"brandName\": \"KEDAUNG\",\n"
" \"sellerId\": \"400603179050\",\n"
" \"mainSellerId\": \"\",\n"
" \"sellerName\": \"Go-Panstore\",\n"
" \"thumbs\": [\n"
" {\n"
" \"image\": \"https://id-test-11.slatic.net/p/f3c88eb266396b1a132413af364c5e97.png\",\n"
" \"sku\": \"5578244948_ID\",\n"
" \"skuId\": \"11032256617\",\n"
" \"itemUrl\": \"/products/gelas-kaca-lusinan-murah-1-set-isi-6-motif-bening-model-cawan-unik-cafe-lucu-cantik-merk-kedaung-harga-murah-tidak-mudah-retak-pecah-bahan-beling-tebal-ukuran-250-ml-elegan-untuk-tamu-rumah-dan-dapur-i5578244948.html\"\n"
" }\n"
" ],\n"
" \"restrictedAge\": 0,\n"
" \"categories\": [\n"
" 16336,\n"
" 16358,\n"
" 16470\n"
" ],\n"
" \"clickTrace\": \"query:gelas+lucu+harga+murah;nid:5578244948;src:LazadaMainSrp;rn:c6e42d21e0c1c781d4df4ad08f2c5705;region:id;sku:5578244948_ID;price:25000.00;client:desktop;supplier_id:400603179050;asc_category_id:16470;item_id:5578244948;sku_id:11032256617;shop_id:2523734\",\n"
" \"addToCartSkus\": [\n"
" {\n"
" \"sku\": \"5578244948_ID-11032256617\",\n"
" \"skuId\": \"11032256617\",\n"
" \"count\": 0\n"
" }\n"
" ],\n"
" \"itemId\": \"5578244948\",\n"
" \"skuId\": \"11032256617\",\n"
" \"inStock\": true,\n"
" \"isAD\": 0,\n"
" \"addToCart\": false,\n"
" \"showFeedBack\": true,\n"
" \"longImageDisplayable\": false,\n"
" \"itemUrl\": \"//www.lazada.co.id/products/gelas-kaca-lusinan-murah-1-set-isi-6-motif-bening-model-cawan-unik-cafe-lucu-cantik-merk-kedaung-harga-murah-tidak-mudah-retak-pecah-bahan-beling-tebal-ukuran-250-ml-elegan-untuk-tamu-rumah-dan-dapur-i5578244948.html\",\n"
" \"querystring\": \"search=1\"\n"
" },\n"
" {\n"
" \"name\": \"Gelas Kaca Lusinan Murah 1 Set Isi 6 Motif Bening Model WHISKEY Unik Cafe Lucu Cantik Merk Kedaung Harga Murah Tidak Mudah Retak Pecah Bahan Beling Tebal Ukuran 250 ml elegan Untuk Tamu Rumah dan Dapur\",\n"
" \"nid\": \"5578230424\",\n"
" \"icons\": [],\n"
" \"image\": \"https://id-test-11.slatic.net/p/df5706ad4c4a457e61b6875b1190aad9.png\",\n"
" \"originalPrice\": \"48000.00\",\n"
" \"originalPriceShow\": \"Rp48.000\",\n"
" \"price\": \"39000.00\",\n"
" \"promotionId\": \"null\",\n"
" \"priceShow\": \"Rp39.000\",\n"
" \"discount\": \"-19%\",\n"
" \"ratingScore\": \"5.0\",\n"
" \"review\": \"2\",\n"
" \"installment\": \"\",\n"
" \"tItemType\": \"nt_product\",\n"
" \"location\": \"Kota Surabaya\",\n"
" \"cheapest_sku\": \"5578230424_ID-11032234543\",\n"
" \"sku\": \"5578230424_ID\",\n"
" \"skus\": [],\n"
" \"brandId\": \"123222884\",\n"
" \"brandName\": \"KEDAUNG\",\n"
" \"sellerId\": \"400603179050\",\n"
" \"mainSellerId\": \"\",\n"
" \"sellerName\": \"Go-Panstore\",\n"
" \"thumbs\": [\n"
" {\n"
" \"image\": \"https://id-test-11.slatic.net/p/df5706ad4c4a457e61b6875b1190aad9.png\",\n"
" \"sku\": \"5578230424_ID\",\n"
" \"skuId\": \"11032234543\",\n"
" \"itemUrl\": \"/products/gelas-kaca-lusinan-murah-1-set-isi-6-motif-bening-model-whiskey-unik-cafe-lucu-cantik-merk-kedaung-harga-murah-tidak-mudah-retak-pecah-bahan-beling-tebal-ukuran-250-ml-elegan-untuk-tamu-rumah-dan-dapur-i5578230424.html\"\n"
" }\n"
" ],\n"
" \"restrictedAge\": 0,\n"
" \"categories\": [\n"
" 16336,\n"
" 16358,\n"
" 16470\n"
" ],\n"
" \"clickTrace\": \"query:gelas+lucu+harga+murah;nid:5578230424;src:LazadaMainSrp;rn:c6e42d21e0c1c781d4df4ad08f2c5705;region:id;sku:5578230424_ID;price:39000.00;client:desktop;supplier_id:400603179050;asc_category_id:16470;item_id:5578230424;sku_id:11032234543;shop_id:2523734\",\n"
" \"addToCartSkus\": [\n"
" {\n"
" \"sku\": \"5578230424_ID-11032234543\",\n"
" \"skuId\": \"11032234543\",\n"
" \"count\": 0\n"
" }\n"
" ],\n"
" \"itemId\": \"5578230424\",\n"
" \"skuId\": \"11032234543\",\n"
" \"inStock\": true,\n"
" \"isAD\": 0,\n"
" \"addToCart\": false,\n"
" \"showFeedBack\": true,\n"
" \"longImageDisplayable\": false,\n"
" \"itemUrl\": \"//www.lazada.co.id/products/gelas-kaca-lusinan-murah-1-set-isi-6-motif-bening-model-whiskey-unik-cafe-lucu-cantik-merk-kedaung-harga-murah-tidak-mudah-retak-pecah-bahan-beling-tebal-ukuran-250-ml-elegan-untuk-tamu-rumah-dan-dapur-i5578230424.html\",\n"
" \"querystring\": \"search=1\"\n"
" },\n"
" {\n"
" \"name\": \"GODJILLA Gelas Cafe Viral Bahan Kaca Bening Cantik Kedaung Drink Jar Harvest 250 ml Set lengkap dengan tutup Stainless dan gagang Aesthetic Lucu Elegan Harga Termurah\",\n"
" \"nid\": \"6413930218\",\n"
" \"icons\": [],\n"
" \"image\": \"https://sg-test-11.slatic.net/p/532045a7c119addbf91e6150d2a441b9.png\",\n"
" \"price\": \"12690.00\",\n"
" \"promotionId\": \"null\",\n"
" \"priceShow\": \"Rp12.690\",\n"
" \"ratingScore\": \"0\",\n"
" \"review\": \"\",\n"
" \"installment\": \"\",\n"
" \"tItemType\": \"nt_product\",\n"
" \"location\": \"Kota Surabaya\",\n"
" \"cheapest_sku\": \"6413930218_ID-12164780997\",\n"
" \"sku\": \"6413930218_ID\",\n"
" \"skus\": [],\n"
" \"brandId\": \"123222884\",\n"
" \"brandName\": \"KEDAUNG\",\n"
" \"sellerId\": \"400625169008\",\n"
" \"mainSellerId\": \"\",\n"
" \"sellerName\": \"Godjilla Online Store\",\n"
" \"thumbs\": [\n"
" {\n"
" \"image\": \"https://sg-live-01.slatic.net/p/cdbfe36dca8c1c5a62f84133ece4966c.jpg\",\n"
" \"sku\": \"6413930218_ID\",\n"
" \"skuId\": \"12164780997\",\n"
" \"itemUrl\": \"/products/godjilla-gelas-cafe-viral-bahan-kaca-bening-cantik-kedaung-drink-jar-harvest-250-ml-set-lengkap-dengan-tutup-stainless-dan-gagang-aesthetic-lucu-elegan-harga-termurah-i6413930218.html\"\n"
" }\n"
" ],\n"
" \"restrictedAge\": 0,\n"
" \"categories\": [\n"
" 16336,\n"
" 16358,\n"
" 16470\n"
" ],\n"
" \"clickTrace\": \"query:gelas+lucu+harga+murah;nid:6413930218;src:LazadaMainSrp;rn:c6e42d21e0c1c781d4df4ad08f2c5705;region:id;sku:6413930218_ID;price:12690.00;client:desktop;supplier_id:400625169008;asc_category_id:16470;item_id:6413930218;sku_id:12164780997;shop_id:4388985\",\n"
" \"addToCartSkus\": [\n"
" {\n"
" \"sku\": \"6413930218_ID-12164780997\",\n"
" \"skuId\": \"12164780997\",\n"
" \"count\": 0\n"
" }\n"
" ],\n"
" \"itemId\": \"6413930218\",\n"
" \"skuId\": \"12164780997\",\n"
" \"inStock\": true,\n"
" \"isAD\": 0,\n"
" \"addToCart\": false,\n"
" \"showFeedBack\": true,\n"
" \"longImageDisplayable\": false,\n"
" \"itemUrl\": \"//www.lazada.co.id/products/godjilla-gelas-cafe-viral-bahan-kaca-bening-cantik-kedaung-drink-jar-harvest-250-ml-set-lengkap-dengan-tutup-stainless-dan-gagang-aesthetic-lucu-elegan-harga-termurah-i6413930218.html\",\n"
" \"querystring\": \"search=1\"\n"
" },\n"
" {\n"
" \"name\": \"GODJILLA Gelas Cafe Viral Bahan Kaca Bening Cantik 3 pcs Kedaung Drink Jar Harvest 250 ml Set lengkap dengan tutup Stainless dan gagang Aesthetic Lucu Elegan Harga Termurah\",\n"
" \"nid\": \"6348904497\",\n"
" \"icons\": [],\n"
" \"image\": \"https://sg-test-11.slatic.net/p/d46be3e12d672790397a73b0bb957972.png\",\n"
" \"originalPrice\": \"33000.00\",\n"
" \"originalPriceShow\": \"Rp33.000\",\n"
" \"price\": \"30500.00\",\n"
" \"promotionId\": \"null\",\n"
" \"priceShow\": \"Rp30.500\",\n"
" \"discount\": \"-8%\",\n"
" \"ratingScore\": \"0\",\n"
" \"review\": \"\",\n"
" \"installment\": \"\",\n"
" \"tItemType\": \"nt_product\",\n"
" \"location\": \"Kota Surabaya\",\n"
" \"cheapest_sku\": \"6348904497_ID-12043432935\",\n"
" \"sku\": \"6348904497_ID\",\n"
" \"skus\": [],\n"
" \"brandId\": \"123222884\",\n"
" \"brandName\": \"KEDAUNG\",\n"
" \"sellerId\": \"400625169008\",\n"
" \"mainSellerId\": \"\",\n"
" \"sellerName\": \"Godjilla Online Store\",\n"
" \"thumbs\": [\n"
" {\n"
" \"image\": \"https://sg-test-11.slatic.net/p/d46be3e12d672790397a73b0bb957972.png\",\n"
" \"sku\": \"6348904497_ID\",\n"
" \"skuId\": \"12043432935\",\n"
" \"itemUrl\": \"/products/godjilla-gelas-cafe-viral-bahan-kaca-bening-cantik-3-pcs-kedaung-drink-jar-harvest-250-ml-set-lengkap-dengan-tutup-stainless-dan-gagang-aesthetic-lucu-elegan-harga-termurah-i6348904497.html\"\n"
" },\n"
" {\n"
" \"image\": \"https://sg-test-11.slatic.net/p/d46be3e12d672790397a73b0bb957972.png\",\n"
" \"sku\": \"6348904497_ID\",\n"
" \"skuId\": \"12043432934\",\n"
" \"itemUrl\": \"/products/godjilla-gelas-cafe-viral-bahan-kaca-bening-cantik-3-pcs-kedaung-drink-jar-harvest-250-ml-set-lengkap-dengan-tutup-stainless-dan-gagang-aesthetic-lucu-elegan-harga-termurah-i6348904497.html\"\n"
" }\n"
" ],\n"
" \"restrictedAge\": 0,\n"
" \"categories\": [\n"
" 16336,\n"
" 16358,\n"
" 16470\n"
" ],\n"
" \"clickTrace\": \"query:gelas+lucu+harga+murah;nid:6348904497;src:LazadaMainSrp;rn:c6e42d21e0c1c781d4df4ad08f2c5705;region:id;sku:6348904497_ID;price:30500.00;client:desktop;supplier_id:400625169008;asc_category_id:16470;item_id:6348904497;sku_id:12043432935;shop_id:4388985\",\n"
" \"addToCartSkus\": [\n"
" {\n"
" \"sku\": \"6348904497_ID-12043432935\",\n"
" \"skuId\": \"12043432935\",\n"
" \"count\": 0\n"
" }\n"
" ],\n"
" \"itemId\": \"6348904497\",\n"
" \"skuId\": \"12043432935\",\n"
" \"inStock\": true,\n"
" \"isAD\": 0,\n"
" \"addToCart\": false,\n"
" \"showFeedBack\": true,\n"
" \"longImageDisplayable\": false,\n"
" \"itemUrl\": \"//www.lazada.co.id/products/godjilla-gelas-cafe-viral-bahan-kaca-bening-cantik-3-pcs-kedaung-drink-jar-harvest-250-ml-set-lengkap-dengan-tutup-stainless-dan-gagang-aesthetic-lucu-elegan-harga-termurah-i6348904497.html\",\n"
" \"querystring\": \"search=1\"\n"
" }\n"
" ],")
matches = re.finditer(regex, test_str)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
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 Python, please visit: https://docs.python.org/3/library/re.html