Regular Expressions 101

Save & Share

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
No Match

r"
"
gmsu

Test String

Code Generator

Generated Code

re = /^\s?[\u1040-\u1049]{1,2}။\s?(?:[\u1000-\u104F\s\-\(\)]+)(?:[\w\s\(\)&\.]+)-(.*?)\n/m str = 'ကိုယ်တိုင်ရေးပုံတူ ၁။ ကိုယ်တိုင်ရေးပုံတူ Art Company - Suzanna ၂။ ဘာအကောင်းဆုံးလည်း Australian Crawl - The Boys Light Up ၃။ အချစ်ကြေညာစာတမ်း The Art Company - Maybe Tomorrow ၄။ ကော်ဖီခါးခါး John Cougar - Authority Song ၅။ တချို့ကကံကောင်းတယ် The Persuaders - Some Guys Have All the Luck ၆။ မမရောဂါ The Art Company - Eileen ၇။ ကြေးစား The Hooters- All You Zombies (credit to @Tun Tun songbook) ၈။ အပြင်လူ-Danger List - John.C.Mellencamp ၉။ မာယာ Saphir - I Feel Good ၁၀။ အက်ဆစ်ဝိုင်ချို John.C Mellencamp - Rain on the Scarecrow ၁၁။ စက်ရုပ်မဟုတ်ဘူး Greg Kihn Band - The Break Up Song ၁၂။ အချစ်ဒိဋ္ဌိ Smokie - Stranger ၁၃။ စိန်ခေါ်ပွဲ Geff Harrison - Bad New York City ၁၄။ သင်္ဘောမှောက်ခြင်း Joe Cocker - Don\'t You Love Me Anymore “ ကော်ဖီခါးခါး “ ၁။ ကော်ဖီခါးခါး John Cougar - Authority song ၂။ တချို့ကကံကောင်းတယ် The Shaker - Some guys have all the luck (The Persuaders) ၃။ ထမိန်တိုတို ရှန်ပိန် Julian Lennon - Too late for goodbyes ၄။ ကိုယ်တိုင်ရေးပုံတူ The Art Company - Susanna ၅။ လေဟာနယ်ထဲမှာ Sutherland Brothers and Quiver - Dr Dancer ၆။ အိမ်မက်ဝိုင် Sutherland Brothers and Quiver - Arms of Mary ၇။ မင်းသဘော Bread - Let your love go ၈။ အချစ်ဝိုင် Bonnie Tyler - Here she comes ၉။ စက်ရုပ်မဟုတ်ဘူး Greg Khin Band - The break up song ၁၀။ တင်းနစ်သမား Chris Rea - Tennis ၁၁။ အပြင်လူ John Cougar - Danger list ၁၂။ မာရ်နတ်ရဲ့ သမီး Albert Hammond - Peacemaker ၁၃။ သစ္စာ (အကျိုးပြု) Billy Joel - Honesty ၁၄။ မျက်ရည်ကျရင် အရှုံး America - And forever ၁၅။ ရွှေရောင်အာရုဏ် Steve Miller Band - Swing town “မျှော်လင့်ချက်” ၁။ ချိုသဲ Craig Mclachaln & Check - Mona ၂။ အမောပြေ လရောင် ?????? ၃။ လှသောပြသနာ ?????? ၄။ လွဲချော်ခြင်း The Beatles - Don\'t let me down ၅။ မျှော်လင့်ချက် ?????? ၆။ ရက်ရက်စက်စက် Bonnie Tyler - Take me back ၇။ ကလေးတစ်ယောက်အိမ်မက် Freddie Augllia - Anak ၈။ သာရွေ့ဝေးသော Bon Jovi - Runaway ၉။ အသည်းအသန်ည Bonnie Tyler - My guns are loaded ၁၀။ မျက်နှာဖုံး Men at Work - Down under ၁၁။ တစ်ဖက်သတ်အချစ် ??????? ၁၂။ ပထမ အသည်းကွဲဇာတ်လမ်း Smokie - Living next door to alice ၁၃။ ရင်အခုန်အခ ျစ် Tanya Tucker - A thing called love ၁၄။ သံသရာ Scorpions - Is there anybody there ၁၅။ အားလုံး Culture Club - Everything I own (original Bread) “ယန္တာရား” ၁။ ယန္တရား John Cougar - Human wheel ၂။ တခါတရံ အချစ်ဆိုသည်မှာ ခံစားမှုသက်သက်မျှသာ Notting Hillbillies - Will you miss me ၃။ မရှောင်နိုင်ဘူး ချစ်မိတယ် UB 40 - Can\'t help falling in love (original Elvis Presley ) ၄။ ၀ိုင်ခွက် ပါးပါး အရက်ပြင်းပြင်း Billy Ray Cyrus - Achy break heart (The Marcy Brothers) ၅။ လှပသော အမှန်တရား John Cougar - Pretty Woman (Roy Orbison ) ၆။ အနီးအဝေး ပြသနာ The Hooters - 500 miles (The Journey Men ) ၇။ ကံကြမ္မာဇာတ်လမ်း Smokie - Don\'t play your Rock N Roll to me ၈။ သံသယ John Lennon - Jealous Guy ၉။ ဘယ်သူမှ အပြစ်မရှိ ????? ၁၀။ ခိုလှုံရာ Tom Petty - Spikes ၁၁။ ယုံကြည်ခြင်း George Michael - Faith ၁၂။ သံသရာအပြေးသမား ????? ၁၃။ စွှန့်စားခန်း Steve Earl - Copper road ၁၄။ အချစ်ရဲ့ ရွှေ Billy Idol - Mony Mony (Tommy James) ရောခ့်သူရဲကောင်းများ ချစ်ကောင်း + ဇော်ဝင်းထွဋ် - ၂။ ကျားတွေက မငိုဘူး ( Tokyo Square - Say you will) ၄။ အိမ်အပြန် ( Bryan Adams - Summer of 69) ၆။ ကိုယ်လိုလူတွေအများကြီး ( <song-Ao Bpai Loey เอาไปเลย/Take It> <artist - Micro/ไมโคร ) ၈။ မင်းမဟုတ်သလိုပဲ ( Eddie Money - Shakin ) ၁၀။ ပြေးလို့လွတ်မှာလား (Stray Cats - Bring it back again) ၁၂။ အချစ်မှ ဟုတ်ရဲ့လား Greg Khin Band - With The Naked Eye ၁၄။ မိုးအောက်မြေပြင် (The Hooters - Johnny B) မင်္ဂလာပါလောက (ချစ်ကောင်း + ဟေမာနေဝင်း) ၁။ ချစ်ကောင်း - မင်္ဂလာပါလောက Thai Song ၃။ ချစ်ကောင်း - အစ်ကိုရေဘာလိုသေးလဲ (The Hooters - Brother don\'t you walk away) ၅။ ချစ်ကောင်း - လွမ်းသူ (George Harrison - Gone Troppo) ၆။ ချစ်ကောင်း - စတော်ဘယ်ရီအိပ်မက် (Smokie - Yesterday dream) ၁၀။ ချစ်ကောင်း - သံယောဇဉ် (Nick Kamen - Don\'t hold out) ၁၂။ ချစ်ကောင်း - ငါ့အချစ်တွေ လျော့ (Marty Straut - Hill Billy rock) ၁၄။ ချစ်ကောင်း - သေသေချာချာလုပ် (Bonnie Tyler - Hide your heart) original-Ace Frehley သင်္ကေတ (ချစ်ကောင်း + လေးလေးဝါး) ၁။ လေးလေးဝါး - ရင်ထဲက ပုဏ္ဍား (Funky Diamonds - I Know That You Want Me) ၂။ ချစ်ကောင်း + လေးလေးဝါး - ဖြေတော့ (UB 40 + Chrissie Hynde - I Got You Babe) Original - Sony + Cher ၃။ ချစ်ကောင်း - သင်္ကေတ (Search - Fatansia Bulan Madu) Malasian Song ၄။ လေးလေးဝါး - အရူးအမူးချစ်မိခြင်း(Celion Dion - Treat Her Like A Lady) ၅။ ချစ်ကောင်း - မျှော်နေသူအတွက်နောက်ဆုံးည (Eric Camen - Hold Me Now) ၆။ လေးလေးဝါး - အရိုင်းလေး (Toni Braxton - Un - Breaken My Heart) ၇။ ချစ်ကောင်း - အလွမ်းဆုံးနေ့ (UB 40 - Here I Am) ၈။ လေးလေးဝါး - အချစ်ရဲ့ကျေးကျွန်(Malaysian Song) ၉။ ချစ်ကောင်း - မရှိမဖြစ်.....မရှိ (Damn Yankees - Silence Is Broken) ၁၀။ လေးလေးဝါး - မရှိတော့မှ (Le Ann Rimes - How Do I live ) ၁၁။ ချစ်ကောင်း - အစွန်းတစ်ဖက် (Wings - Pernafas Oalam Lumpur) Malaysian Song' # Print the match result str.scan(re) do |match| puts match.to_s end

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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html