Regular Expressions 101

Save & Share

  • Regex Version: ver. 38
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression

/
/
g

Test String

Code Generator

Generated Code

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @"""listItems""\s*:\s*([^}]+)"; string input = @"""listItems"": [ { ""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"", ""nid"": ""5609668850"", ""icons"": [], ""image"": ""https://id-test-11.slatic.net/p/0227998499138451f7cc6ada1d885a7b.png"", ""originalPrice"": ""35000.00"", ""originalPriceShow"": ""Rp35.000"", ""price"": ""29000.00"", ""promotionId"": ""null"", ""priceShow"": ""Rp29.000"", ""discount"": ""-17%"", ""ratingScore"": ""0"", ""review"": "", ""installment"": "", ""tItemType"": ""nt_product"", ""location"": ""Kota Surabaya"", ""cheapest_sku"": ""5609668850_ID-11061072628"", ""sku"": ""5609668850_ID"", ""skus"": [], ""brandId"": ""123222884"", ""brandName"": ""KEDAUNG"", ""sellerId"": ""400603179050"", ""mainSellerId"": "", ""sellerName"": ""Go-Panstore"", ""thumbs"": [ { ""image"": ""https://id-test-11.slatic.net/p/0227998499138451f7cc6ada1d885a7b.png"", ""sku"": ""5609668850_ID"", ""skuId"": ""11061072628"", ""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"" } ], ""restrictedAge"": 0, ""categories"": [ 16336, 16358, 16470 ], ""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"", ""addToCartSkus"": [ { ""sku"": ""5609668850_ID-11061072628"", ""skuId"": ""11061072628"", ""count"": 0 } ], ""itemId"": ""5609668850"", ""skuId"": ""11061072628"", ""inStock"": true, ""isAD"": 0, ""addToCart"": false, ""showFeedBack"": true, ""longImageDisplayable"": false, ""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"", ""querystring"": ""search=1"" }, { ""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"", ""nid"": ""5578244948"", ""icons"": [], ""image"": ""https://id-test-11.slatic.net/p/f3c88eb266396b1a132413af364c5e97.png"", ""originalPrice"": ""35000.00"", ""originalPriceShow"": ""Rp35.000"", ""price"": ""25000.00"", ""promotionId"": ""null"", ""priceShow"": ""Rp25.000"", ""discount"": ""-29%"", ""ratingScore"": ""0"", ""review"": "", ""installment"": "", ""tItemType"": ""nt_product"", ""location"": ""Kota Surabaya"", ""cheapest_sku"": ""5578244948_ID-11032256617"", ""sku"": ""5578244948_ID"", ""skus"": [], ""brandId"": ""123222884"", ""brandName"": ""KEDAUNG"", ""sellerId"": ""400603179050"", ""mainSellerId"": "", ""sellerName"": ""Go-Panstore"", ""thumbs"": [ { ""image"": ""https://id-test-11.slatic.net/p/f3c88eb266396b1a132413af364c5e97.png"", ""sku"": ""5578244948_ID"", ""skuId"": ""11032256617"", ""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"" } ], ""restrictedAge"": 0, ""categories"": [ 16336, 16358, 16470 ], ""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"", ""addToCartSkus"": [ { ""sku"": ""5578244948_ID-11032256617"", ""skuId"": ""11032256617"", ""count"": 0 } ], ""itemId"": ""5578244948"", ""skuId"": ""11032256617"", ""inStock"": true, ""isAD"": 0, ""addToCart"": false, ""showFeedBack"": true, ""longImageDisplayable"": false, ""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"", ""querystring"": ""search=1"" }, { ""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"", ""nid"": ""5578230424"", ""icons"": [], ""image"": ""https://id-test-11.slatic.net/p/df5706ad4c4a457e61b6875b1190aad9.png"", ""originalPrice"": ""48000.00"", ""originalPriceShow"": ""Rp48.000"", ""price"": ""39000.00"", ""promotionId"": ""null"", ""priceShow"": ""Rp39.000"", ""discount"": ""-19%"", ""ratingScore"": ""5.0"", ""review"": ""2"", ""installment"": "", ""tItemType"": ""nt_product"", ""location"": ""Kota Surabaya"", ""cheapest_sku"": ""5578230424_ID-11032234543"", ""sku"": ""5578230424_ID"", ""skus"": [], ""brandId"": ""123222884"", ""brandName"": ""KEDAUNG"", ""sellerId"": ""400603179050"", ""mainSellerId"": "", ""sellerName"": ""Go-Panstore"", ""thumbs"": [ { ""image"": ""https://id-test-11.slatic.net/p/df5706ad4c4a457e61b6875b1190aad9.png"", ""sku"": ""5578230424_ID"", ""skuId"": ""11032234543"", ""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"" } ], ""restrictedAge"": 0, ""categories"": [ 16336, 16358, 16470 ], ""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"", ""addToCartSkus"": [ { ""sku"": ""5578230424_ID-11032234543"", ""skuId"": ""11032234543"", ""count"": 0 } ], ""itemId"": ""5578230424"", ""skuId"": ""11032234543"", ""inStock"": true, ""isAD"": 0, ""addToCart"": false, ""showFeedBack"": true, ""longImageDisplayable"": false, ""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"", ""querystring"": ""search=1"" }, { ""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"", ""nid"": ""6413930218"", ""icons"": [], ""image"": ""https://sg-test-11.slatic.net/p/532045a7c119addbf91e6150d2a441b9.png"", ""price"": ""12690.00"", ""promotionId"": ""null"", ""priceShow"": ""Rp12.690"", ""ratingScore"": ""0"", ""review"": "", ""installment"": "", ""tItemType"": ""nt_product"", ""location"": ""Kota Surabaya"", ""cheapest_sku"": ""6413930218_ID-12164780997"", ""sku"": ""6413930218_ID"", ""skus"": [], ""brandId"": ""123222884"", ""brandName"": ""KEDAUNG"", ""sellerId"": ""400625169008"", ""mainSellerId"": "", ""sellerName"": ""Godjilla Online Store"", ""thumbs"": [ { ""image"": ""https://sg-live-01.slatic.net/p/cdbfe36dca8c1c5a62f84133ece4966c.jpg"", ""sku"": ""6413930218_ID"", ""skuId"": ""12164780997"", ""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"" } ], ""restrictedAge"": 0, ""categories"": [ 16336, 16358, 16470 ], ""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"", ""addToCartSkus"": [ { ""sku"": ""6413930218_ID-12164780997"", ""skuId"": ""12164780997"", ""count"": 0 } ], ""itemId"": ""6413930218"", ""skuId"": ""12164780997"", ""inStock"": true, ""isAD"": 0, ""addToCart"": false, ""showFeedBack"": true, ""longImageDisplayable"": false, ""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"", ""querystring"": ""search=1"" }, { ""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"", ""nid"": ""6348904497"", ""icons"": [], ""image"": ""https://sg-test-11.slatic.net/p/d46be3e12d672790397a73b0bb957972.png"", ""originalPrice"": ""33000.00"", ""originalPriceShow"": ""Rp33.000"", ""price"": ""30500.00"", ""promotionId"": ""null"", ""priceShow"": ""Rp30.500"", ""discount"": ""-8%"", ""ratingScore"": ""0"", ""review"": "", ""installment"": "", ""tItemType"": ""nt_product"", ""location"": ""Kota Surabaya"", ""cheapest_sku"": ""6348904497_ID-12043432935"", ""sku"": ""6348904497_ID"", ""skus"": [], ""brandId"": ""123222884"", ""brandName"": ""KEDAUNG"", ""sellerId"": ""400625169008"", ""mainSellerId"": "", ""sellerName"": ""Godjilla Online Store"", ""thumbs"": [ { ""image"": ""https://sg-test-11.slatic.net/p/d46be3e12d672790397a73b0bb957972.png"", ""sku"": ""6348904497_ID"", ""skuId"": ""12043432935"", ""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"" }, { ""image"": ""https://sg-test-11.slatic.net/p/d46be3e12d672790397a73b0bb957972.png"", ""sku"": ""6348904497_ID"", ""skuId"": ""12043432934"", ""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"" } ], ""restrictedAge"": 0, ""categories"": [ 16336, 16358, 16470 ], ""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"", ""addToCartSkus"": [ { ""sku"": ""6348904497_ID-12043432935"", ""skuId"": ""12043432935"", ""count"": 0 } ], ""itemId"": ""6348904497"", ""skuId"": ""12043432935"", ""inStock"": true, ""isAD"": 0, ""addToCart"": false, ""showFeedBack"": true, ""longImageDisplayable"": false, ""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"", ""querystring"": ""search=1"" } ],"; foreach (Match m in Regex.Matches(input, pattern)) { Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index); } } }

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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx