Regular Expressions 101

Save & Share

  • Regex Version: ver. 1
  • 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

/
/
gs

Test String

Substitution

Processing...

Code Generator

Generated Code

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @".*?""artists"".*?jpg""\},""name"":""(.*?)"".*?catalog_number"":""(.*?)"".*?\},""name"":""(.*?)"",""new_release_date"":""(.*?)"".*?|.*<\/html>"; string substitution = @"$2\t$1\t$3\t$4\n"; string input = @",""publish_date"":""2022-05-04"",""remixers"":[],""slug"":""independiente"",""track_count"":2,""upc"":""5057272832285"",""updated"":""2022-05-04T00:09:42-06:00"",""url"":""https://api-internal.beatportprod.com/v4/catalog/releases/3713459/"",""is_hype"":false},{""artists"":[{""id"":637976,""image"":{""id"":5539565,""uri"":""https://geo-media.beatport.com/image_size/590x404/0dc61986-bccf-49d4-8fad-6b147ea8f327.jpg"",""dynamic_uri"":""https://geo-media.beatport.com/image_size/{w}x{h}/0dc61986-bccf-49d4-8fad-6b147ea8f327.jpg""},""name"":""SounEmot"",""slug"":""sounemot"",""url"":""https://api-internal.beatportprod.com/v4/catalog/artists/637976/""}],""bpm_range"":{""min"":123,""max"":140},""catalog_number"":"" HER032"",""desc"":""Liquid Dream is back home with this wonderful remix that gives a different feeling to the original \""The Best Of You\"" from \""SounEmot\"",""enabled"":true,""encoded_date"":""2022-03-05T11:04:53-07:00"",""exclusive"":false,""id"":3677155,""image"":{""id"":32123136,""uri"":""https://geo-media.beatport.com/image_size/1400x1400/df8b2729-302c-4965-86fe-bdc156d472be.jpg"",""dynamic_uri"":""https://geo-media.beatport.com/image_size/{w}x{h}/df8b2729-302c-4965-86fe-bdc156d472be.jpg""},""label"":{""id"":96888,""name"":""High Emotions Recordings"",""image"":{""id"":34769235,""uri"":""https://geo-media.beatport.com/image_size/500x500/fcd8bb5d-04f6-4713-ae37-100f4efa54cf.jpg"",""dynamic_uri"":""https://geo-media.beatport.com/image_size/{w}x{h}/fcd8bb5d-04f6-4713-ae37-100f4efa54cf.jpg""},""slug"":""high-emotions-recordings""},""name"":""The Best of You Remixed (Liquid Dream Remix)"",""new_release_date"":""2022-04-29"",""override_price"":null,""pre_order"":false,""pre_order_date"":null,""price"":{""code"":""USD"",""symbol"":""$"",""value"":2.58,""display"":""$2.58""},""price_override_firm"":false,""publish_date"":""2022-04-29"",""remixers"":[{""id"":685512,""image"":{""id"":5539565,""uri"":""https://geo-media.beatport.com/image_size/590x404/0dc61986-bccf-49d4-8fad-6b147ea8f327.jpg"",""dynamic_uri"":""https://geo-media.beatport.com/image_size/{w}x{h}/0dc61986-bccf-49d4-8fad-6b147ea8f327.jpg""},""name"":""Liquid Dream"",""slug"":""liquid-dream"",""url"":""https://api-internal.beatportprod.com/v4/catalog/artists/685512/""}],""slug"":""the-best-of-you-remixed-liquid-dream-remix"",""track_count"":2,""upc"":""5057272794156"",""updated"":""2022-09-12T13:02:18-06:00"",""url"":""https://api-internal.beatportprod.com/v4/catalog/releases/3677155/"",""is_hype"":false},{""artists"":[{""id"":378771,""image"":{""id"":5539565,""uri"":""https://geo-media.beatport.com/image_size/590x404/0dc61986-bccf-49d4-8fad-6b147ea8f327.jpg"",""dynamic_uri"":""https://geo-media.beatport.com/image_size/{w}x{h}/0dc61986-bccf-49d4-8fad-6b147ea8f327.jpg""},""name"":""Boriz Vicious"",""slug"":""boriz-vicious"",""url"":""https://api-internal.beatportprod.com/v4/catalog/artists/378771/""}],""bpm_range"":{""min"":140,""max"":140},""catalog_number"":""HER032"",""desc"":""Boriz Vicious makes his debut in High Emotions.\nwith these two tracks very much in his Boriz Vicious style \""Blood Moon \u0026 Adios Madre\""."",""enabled"":true,""encoded_date"":""2022-03-25T10:48:00-06:00"",""exclusive"":false,""id"":3699985,""image"":{""id"":30933010,""uri"":""https://geo-media.beatport.com/image_size/1400x1400/c5b73e0c-f607-4eab-aab5-0c4f1e228bce.jpg"",""dynamic_uri"":""https://geo-media.beatport.com/image_size/{w}x{h}/c5b73e0c-f607-4eab-aab5-0c4f1e228bce.jpg""},""label"":{""id"":96888,""name"":""High Emotions Recordings"",""image"":{""id"":34769235,""uri"":""https://geo-media.beatport.com/image_size/500x500/fcd8bb5d-04f6-4713-ae37-100f4efa54cf.jpg"",""dynamic_uri"":""https://geo-media.beatport.com/image_size/{w}x{h}/fcd8bb5d-04f6-4713-ae37-100f4efa54cf.jpg""},""slug"":""high-emotions-recordings""},""name"":""Blood Moon / Adios Madre"",""new_release_date"":""2022-04-27"",""override_price"":null,""pre_order"":false,""pre_order_date"":null,""price"":{""code"":""USD"",""symbol"":""$"",""value"":2.58,""display"":""$2.58""},""price_override_firm"":false,""publish_date"":""2022-04-27"",""remixers"":[],""slug"":""blood-moon-adios-madre"",""track_count"":2,""upc"":""5057272816414"",""updated"":""2022-04-27T00:10:41-06:00"",""url"":""https://api-internal.beatportprod.com/v4/catalog/releases/3699985/"",""is_hype"":false},{""artists"":[{""id"":885794,""image"":{""id"":5539565,""uri"":""https://geo-media.beatport.com/image_size/590x404/0dc61986-bccf-49d4-8fad-6b147ea8f327.jpg"",""dynamic_uri"":""https://geo-media.beatport.com/image_size/{w}x{h}/0dc61986-bccf-49d4-8fad-6b147ea8f327.jpg""},""name"":""Cj Mover"",""slug"":""cj-mover"",""url"":""https://api-internal.beatportprod.com/v4/catalog/artists/885794/""}],""bpm_range"":{""min"":140,""max"":141},""catalog_number"":""HER031"",""desc"":""An energetic track with guitar plucks is present in High Emotions, \""Cj Mover\"" makes its mark with this great track \""Hope Dies Last\""."",""enabled"":true,""encoded_date"":""2022-03-15T21:03:30-06:00"",""exclusive"":false,""id"":3690041,""image"":{""id"":30809730,""uri"":""https://geo-media.beatport.com/image_size/1400x1400/e37973b3-c3b7-465e-b7b7-9a8367a6c430.jpg"",""dynamic_uri"":""https://geo-media.beatport.com/image_size/{w}x{h}/e37973b3-c3b7-465e-b7b7-9a8367a6c430.jpg""},""label"":{""id"":96888,""name"":""High Emotions Recordings"",""image"":{""id"":34769235,""uri"":""https://geo-media.beatport.com/image_size/500x500/fcd8bb5d-04f6-4713-ae37-100f4efa54cf.jpg"",""dynamic_uri"":""https://geo-media.beatport.com/image_size/{w}x{h}/fcd8bb5d-04f6-4713-ae37-100f4efa54cf.jpg""},""slug"":""high-emotions-recordings""},""name"":""Hope Dies Last"",""new_release_date"":""2022-04-20"",""override_price"":null,""pre_order"":false,""pre_order_date"":null,""price"":{""code"":""USD"",""symbol"":""$"",""value"":2.58,""display"":""$2.58""},""price_override_firm"":false,""publish_date"":""2022-04-20"",""remixers"":[],""slug"":""hope-dies-last"",""track_count"":2,""upc"":""5057272806231"",""updated"":""2022-04-20T00:09:44-06:00"",""url"":""https://api-internal.beatportprod.com/v4/catalog/releases/3690041/"",""is_hype"":false},{""artists"":[{""id"":1002384,""image"":{""id"":31560385,""uri"":""https://geo-media.beatport.com/image_size/590x404/65b4debc-eb68-45a6-8b35-9c090c694232.jpg"",""dynamic_uri"":</html>"; RegexOptions options = RegexOptions.Singleline; Regex regex = new Regex(pattern, options); string result = regex.Replace(input, 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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx