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

/
/
g

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 = "\@?T\(.*?\)" Local $sString = "@{" & @CRLF & _ " Layout = "~/Views/Shared/_Layout.cshtml";" & @CRLF & _ " ViewBag.SeoTitle = T("PVC Kapı ve Pencere Sistemleri | Gedizpen").ToString();" & @CRLF & _ " ViewBag.MetaDescription = T("Dünyada PVC Kapı ve Pencere sistemlerini oluşturan parçaların tamamını üreten tek firma olan Winhouse'un pencere ve kapı ürünleri detayları için tıklayın!").ToString();" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "<!-- =HomeSlider -->" & @CRLF & _ "<section class="home-slider-section">" & @CRLF & _ " <div class="container">" & @CRLF & _ " <div class="home-slider-wrapper">" & @CRLF & _ " <div class="home-slider flexslider">" & @CRLF & _ " <ul class="slides">" & @CRLF & _ " @foreach (var slider in ContentManager.LoadByType("Slider", CurrentCulture).Where(x => x.Status))" & @CRLF & _ " {" & @CRLF & _ " <li>" & @CRLF & _ " @if (!string.IsNullOrEmpty(slider.Link))" & @CRLF & _ " {" & @CRLF & _ " <a href="@slider.Link" target="@slider.LinkTarget">" & @CRLF & _ " <img src="@MediaService.GetContentRoute((int)slider.Id, "SliderImage").IfNotNull(x => StaticContent(x.Url))" alt="@slider.Title" data-desc="@slider.Description">" & @CRLF & _ " </a>" & @CRLF & _ " }" & @CRLF & _ " else" & @CRLF & _ " {" & @CRLF & _ " <img src="@MediaService.GetContentRoute((int)slider.Id, "SliderImage").IfNotNull(x => StaticContent(x.Url))" alt="@slider.Title" data-desc="@slider.Description">" & @CRLF & _ " }" & @CRLF & _ " </li>" & @CRLF & _ " }" & @CRLF & _ " </ul>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ "</section>" & @CRLF & _ "<!-- =HomeSlider -->" & @CRLF & _ "" & @CRLF & _ "<!-- =HomeWidgets -->" & @CRLF & _ "<section class="home-widgets-section">" & @CRLF & _ " <div class="container">" & @CRLF & _ " <div class="inner clearfix">" & @CRLF & _ " <div class="home-widget home-widget-1">" & @CRLF & _ " <h2 class="heading">@T("Haberler &amp; Duyurular")</h2>" & @CRLF & _ " <div class="widget-content">" & @CRLF & _ " <div class="news-slider-wrapper">" & @CRLF & _ " <div class="news-slider flexslider" data-prev=".news-slider-wrapper .prev" data-next=".news-slider-wrapper .next">" & @CRLF & _ " <ul class="slides">" & @CRLF & _ "" & @CRLF & _ " @foreach (var announcement in ContentManager.LoadByType("Announcement", CurrentCulture).Where(x => x.Status && x.ContentCategory.GroupKey == Guid.Parse("430D75FE-BAB8-4566-AE56-A06C515CE6D6")).OrderByDescending(x => x.CreatedDate).Take(3))" & @CRLF & _ " {" & @CRLF & _ " <li><a href="@ContentRouteManager.GetContentRouteUrl(announcement.Id)">@(((string)announcement.SpotText).TruncateAtWord(110))<img class="figure" src="@MediaService.GetContentRoute((int)announcement.Id, "AnnouncementImage").IfNotNull(x => StaticContent(x.Url))" alt="@announcement.Title"></a></li>" & @CRLF & _ " }" & @CRLF & _ " </ul>" & @CRLF & _ " </div>" & @CRLF & _ " <a class="prev arrow ir" href="javascript:;"><span>&laquo;</span></a>" & @CRLF & _ " <a class="next arrow ir" href="javascript:;"><span>&raquo;</span></a>" & @CRLF & _ " </div>" & @CRLF & _ " <a class="read-more" href="@GetPreDefinedPageUrl("Index", "Announcement")">@T("Tüm Haberler")</a>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " <div class="home-widget home-widget-2">" & @CRLF & _ " <h2 class="heading">@T("Size En Yakın Bayi Nerede ?")</h2>" & @CRLF & _ " <div class="widget-content">" & @CRLF & _ " <form class="nearest-dealer-search-form">" & @CRLF & _ " <div class="input-wrapper js-select-wrapper">" & @CRLF & _ " @*@Html.DropDownListFor(x => x.City, Model.Cities, "Lütfen il seçiniz...", new { @class = "style" })*@" & @CRLF & _ " @Html.DropDownList("City", T("Lütfen il seçiniz...").ToString())" & @CRLF & _ " </div>" & @CRLF & _ " <div class="input-wrapper js-select-wrapper">" & @CRLF & _ " @*@Html.DropDownListFor(x => x.County, Model.Counties, "Önce il seçiniz...", new { @class = "style" })*@" & @CRLF & _ " @Html.DropDownList("County", T("Önce il seçiniz...").ToString())" & @CRLF & _ " </div>" & @CRLF & _ " <div class="submit-wrapper">" & @CRLF & _ " <a href="javascript:;" class="theme-button">" & @CRLF & _ " <span>@T("ARA")</span>" & @CRLF & _ " </a>" & @CRLF & _ " </div>" & @CRLF & _ " </form>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " <div class="home-widget home-widget-3">" & @CRLF & _ " <h2 class="heading">@T("Pencere Mühendislik Hesaplamaları")</h2>" & @CRLF & _ " <div class="widget-content">" & @CRLF & _ " <p>@T("Pencere uygulamasında ihtiyaç duyduğunuz pencere mühendislik hesaplamalarını yapabilirsiniz.")</p>" & @CRLF & _ " <a class="read-more" href="@GetPreDefinedPageUrl("WindowCalculations", "Calculations")">@T("Detaylı Bilgi")</a>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ "</section>" & @CRLF & _ "<!-- =HomeWidgets -->" & @CRLF & _ "" & @CRLF & _ "<!-- =FeaturedLinks -->" & @CRLF & _ "<div class="featured-links-section">" & @CRLF & _ " <div class="container">" & @CRLF & _ " <div class="inner clearfix">" & @CRLF & _ " <div class="featured-links">" & @CRLF & _ " <a href="@ContentRouteManager.GetContentRouteUrl("9ce86817-8a24-44b9-a32a-4dff918ada50")" class="featured-link featured-link-1">" & @CRLF & _ " <span class="icon">" & @CRLF & _ " <i class="theme-icon-drill"></i>" & @CRLF & _ " <span></span>" & @CRLF & _ " </span>" & @CRLF & _ " <strong class="title">" & @CRLF & _ " @T("<span>Pencere</span> <span>Montaj Uygulaması</span>")" & @CRLF & _ " </strong>" & @CRLF & _ " </a>" & @CRLF & _ " <a href="@ContentRouteManager.GetContentRouteUrl("95bd8a0d-d53b-42cb-9372-411c28d2b378")" class="featured-link featured-link-2">" & @CRLF & _ " <span class="icon">" & @CRLF & _ " <i class="theme-icon-home"></i>" & @CRLF & _ " <span></span>" & @CRLF & _ " </span>" & @CRLF & _ " <strong class="title">" & @CRLF & _ " @T("<span>Size Özel</span> <span>Pencereler</span>")" & @CRLF & _ " </strong>" & @CRLF & _ " </a>" & @CRLF & _ " <a href="@ContentRouteManager.GetContentRouteUrl("d0a6cecf-82c6-4705-91b4-8902073ab627")" class="featured-link featured-link-3">" & @CRLF & _ " <span class="icon">" & @CRLF & _ " <i class="theme-icon-window"></i>" & @CRLF & _ " <span></span>" & @CRLF & _ " </span>" & @CRLF & _ " <strong class="title">" & @CRLF & _ " @T("<span>Pencere</span> <span>Animasyonları</span>")" & @CRLF & _ " </strong>" & @CRLF & _ " </a>" & @CRLF & _ " <a href="@ContentRouteManager.GetContentRouteUrl("da4e73a9-d845-433e-bc04-8844557cdbb9")" class="featured-link featured-link-4">" & @CRLF & _ " <span class="icon">" & @CRLF & _ " <i class="theme-icon-check"></i>" & @CRLF & _ " <span></span>" & @CRLF & _ " </span>" & @CRLF & _ " <strong class="title">" & @CRLF & _ " @T("<span>FUDEL Akredite</span> <span>Pencere Laboratuarı</span>")" & @CRLF & _ " </strong>" & @CRLF & _ " </a>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ "</div>" & @CRLF & _ "<!-- =FeaturedLinks -->" & @CRLF & _ "" & @CRLF & _ "@section Head{" & @CRLF & _ " @Styles.Render("~/assets/css/plugins/jquery.flexslider.min.css")" & @CRLF & _ " @Styles.Render("~/assets/css/plugins/jquery.mcustomscrollbar.css")" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "@section Plugins{" & @CRLF & _ " @Scripts.Render("~/assets/js/plugins/jquery.flexslider.min.js")" & @CRLF & _ " @Scripts.Render("~/assets/js/plugins/jquery.mcustomscrollbar.js")" & @CRLF & _ "}" 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