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

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

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 AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm