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
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • 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

/
/
gm

Test String

Substitution

Processing...

Code Generator

Generated Code

#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox Local $sRegex = "(?m);\s*color:\s*#ff+;" Local $sString = "<span id="JobDescCKEditor" class="JobDescCKEditor"><div class="sVx81"style="color: #222222; font-size: 14px;">" & @CRLF & _ "<div class="OghIW">" & @CRLF & _ "<div class="sH3zFd">" & @CRLF & _ "<h2 class="KLsYvd" style="font-size: 30px;" tabindex="-1">Dot Net Developer/Senior Developer/Lead</h2>" & @CRLF & _ "<div class="MpVvlf sb-unsaved">&nbsp;</div>" & @CRLF & _ "<span class="SGdgT"><span class="povykd" tabindex="0" role="button" data-extra-container-classes="signin-content" data-theme="0" data-width="304"><span class="pWJs7b sb-unsaved-label" style="color: rgba(0, 0, 0, 0.54); font-size: 14px;">SAVE</span></span></span>" & @CRLF & _ "<div data-dst="Dot Net Developer/Senior Developer/Lead" data-dsu=";jobs&amp;q=asp.net+developer+jobs+in+coimbatore&amp;hl=en-IN&amp;kgs=fc48b0cab3c47379&amp;shndl=-1&amp;source=sh/x/im/textlists/detail&amp;entrypoint=sh/x/im/textlists/detail#fpstate=tldetail&amp;htivrt=jobs&amp;htiq=asp.net+developer+jobs+in+coimbatore&amp;htidocid=kt8uTf65bML56BEcAAAAAA%3D%3D" data-shortu="" data-jsdata="" data-ved="0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQgmQI9gcwAA">&nbsp;</div>" & @CRLF & _ "</div>" & @CRLF & _ "<div class="iGy6ud">" & @CRLF & _ "<div class="ZUeoqc">" & @CRLF & _ "<div style="font-size: 20px;">" & @CRLF & _ "<div class="EtwWxe" style="color: #ffffff;" aria-hidden="true">I</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "<div class="tJ9zfc" style="color: rgba(0, 0, 0, 0.54); font-size: 14px;">" & @CRLF & _ "<div class="nJlQNd sMzDkb">Impiger Technologies</div>" & @CRLF & _ "<div class="sMzDkb">Coimbatore, Tamil Nadu</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "<div class="GfgB1" style="color: #222222; font-size: 14px;" data-ved="0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQn-cDCIEIMAA">&nbsp;</div>" & @CRLF & _ "<div class="mR2gOd" data-hveid="1027" data-ved="0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQ890CCIMIMAA">" & @CRLF & _ "<div class="EDblX DAVP1">" & @CRLF & _ "<div class="B8oxKe"><span class="DaDV9e" tabindex="-1"><a class="" style="color: #ffffff; font-size: 14px;" title="Apply on AngelList" target="_blank" rel="noopener" data-ved="0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQpowCCIQIKAAwAA">Apply on AngelList</a></span></div>" & @CRLF & _ "<div class="B8oxKe BQC79e" data-jsdata="">" & @CRLF & _ "<div id="jdaokt8uTf65bML56BEcAAAAAA==" class="y yf" data-jiis="up" data-async-type="jb_apply_options" data-async-context-required="htidocid,ibp" data-async-rclass="search" data-ved="0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQld4CCIUIKAEwAA"></div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "<div class="CyxPy EPhEaf" style="color: #ffffff;">&nbsp;</div>" & @CRLF & _ "<div>&nbsp;</div>" & @CRLF & _ "<div>&nbsp;</div>" & @CRLF & _ "<div class="w5NUMb" style="color: #222222; font-size: 14px;">&nbsp;</div>" & @CRLF & _ "<div class="ocResc icFQAc" style="color: #222222; font-size: 14px;"><span class="n1Mpqb" style="color: rgba(0, 0, 0, 0.54);"><span class="SuWscb">Over 1 month ago</span></span><span class="n1Mpqb" style="color: rgba(0, 0, 0, 0.54);"><span class="SuWscb">?2L–?9L a year</span></span><span class="n1Mpqb" style="color: rgba(0, 0, 0, 0.54);"><span class="SuWscb">Full–time</span></span></div>" & @CRLF & _ "<div class="YgLbBe" style="color: rgba(0, 0, 0, 0.87); font-size: 14px;">" & @CRLF & _ "<div class="config-text-expandable"><span class="HBvzbc">· Demonstrate a high level of competence in object-oriented analysis, design, and coding in a .NET server-side environment, specifically in utilizing the Microsoft MVC framework. Experience in Angular is an added advantage. · Adhere to the standards and comply with HTML, CSS and JavaScript codes with respect to the artworks and technical specifications provided · Design and implement systems that use relational databases, specifically SQL 2008 R2 · Work on pre-defined requirements and produce code that meets the requirements · Demonstrate a structured approach to development, using design patterns wherever appropriate, and use SOLID principle and strive hard to continuously improve the development process · Take responsibility for the deliverables and contribute effectively to the team · Possess enthusiasm and passion for technology and crave for honing new skills Impiger Technologies focuses on Cloud Computing and Mobile Application. Their company has offices in Coimbatore<span class="WbZuDe"> They have a large team that's between 201-500 employees. You can view their website at </span></span></div>" & @CRLF & _ "</div>" & @CRLF & _ "<div style="color: #222222; font-size: 14px;" data-async-context="async_id:duf3-47-_K-R_X8KwOOXYz7sP8Z2PwA02;authority:0;card_id:;entry_point:0;feature_id:;ftoe:0;header:0;is_jobs_spam_form:1;open:0;preselect_answer_index:-1;suggestions:;suggestions_subtypes:;suggestions_types:;surface:0;title:;type:47">" & @CRLF & _ "<div id="duf3-47-_K-R_X8KwOOXYz7sP8Z2PwA02" class="y yp" data-jiis="up" data-async-type="duffy3" data-async-context-required="type,open,feature_id,async_id,entry_point,authority,card_id,ftoe,title,header,suggestions,surface,suggestions_types,suggestions_subtypes,preselect_answer_index,is_jobs_spam_form" data-ved="0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQ-0EIjQgwAA"></div>" & @CRLF & _ "<div class="egHvEc hide-focus-ring" tabindex="0" role="link" data-async-trigger="duf3-47-_K-R_X8KwOOXYz7sP8Z2PwA02" data-ved="0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQ5ZkFCI4IMAA"><span class="XVmsDd" style="color: #212121; font-size: 14px;">Report this listing</span></div>" & @CRLF & _ "</div>" & @CRLF & _ "<div class="gWhMmc" style="color: #222222; font-size: 14px;" data-jsdata="">" & @CRLF & _ "<div id="jdskt8uTf65bML56BEcAAAAAA==" class="y yf" data-jiis="up" data-async-type="jb_salary" data-async-context-required="htidocid,ibp" data-async-rclass="search" data-ved="0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQudsCCI8IMAA">" & @CRLF & _ "<div id="gws-plugins-horizon-jobs__salary">" & @CRLF & _ "<div class="iE9pwb">" & @CRLF & _ "<div class="XdTbkf">" & @CRLF & _ "<div class="bKLZtb BAgzfc" style="color: rgba(0, 0, 0, 0.87);">Salary comparison</div>" & @CRLF & _ "<div class="URn80">" & @CRLF & _ "<div class="HWnzvc" aria-label="More info">&nbsp;</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "<div>" & @CRLF & _ "<div class="ZDG8hb" style="color: rgba(0, 0, 0, 0.54); font-size: 12px;">" & @CRLF & _ "<div class="UcFhic">" & @CRLF & _ "<div class="fjnW5b GPnHhd">&nbsp;</div>" & @CRLF & _ "Impiger Technologies</div>" & @CRLF & _ "<div class="UcFhic">" & @CRLF & _ "<div class="ZZ1t4d GPnHhd">&nbsp;</div>" & @CRLF & _ "Local employers via&nbsp;<a class="aPBtBe" style="color: #4285f4;" target="_blank" rel="noopener">PayScale</a></div>" & @CRLF & _ "</div>" & @CRLF & _ "<div class="zrUdLc">&nbsp;160k&nbsp;420k&nbsp;680k?2L–900k?2.2L–530k</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "<div class="EWizoc" style="color: #ffffff; font-size: 14px;"><span class="sssrNe" style="color: rgba(0, 0, 0, 0.87); font-size: 20px;">Impiger Technologies</span></div>" & @CRLF & _ "<div class="AtCEfb" style="color: #222222; font-size: 14px;color: #ffffff;" data-jsdata="">" & @CRLF & _ "<div id="fc_6" class="y yf" data-async-fc="EvcBCrcBQUc4Q2tLaDZqNk45dEZldmx6OFhzWlE1SzJzZ2pZckNuOW1RTVRFb3JIbjVpY0swalFGM3lJYjNxU2h2d1ZvMXNRSXl0WHhSWDF4S3h5bzBGV2VXTEpxS2lIdTdqN1RoTHVuN0ZYTnVHdGJ4eHBjdnVVVkFpYXdjMlNDdGMzSUxwOW83Q3FxRERjeERNbm8wX2tKMnY4cmpnc2o4bE82Y0pjckIwMkpQVXBtVTBVNVVhTzJ2VGRjEhdLLVJfWDhLd09PWFl6N3NQOFoyUHdBMBoiQU1lZHd5TEk0dkd2LUVaTjdHQ2VPblJVbkM4cWpob0d6QQ" data-async-fcv="3" data-async-ons="731" data-async-rclass="search" data-ved="0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQmbECCJAIMAA">" & @CRLF & _ "<div>" & @CRLF & _ "<div class="gaLgbc">" & @CRLF & _ "<div class="qySoyb" style="color: rgba(0, 0, 0, 0.87); font-size: 14px;background-color: #ffffff">Glassdoor</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div>" & @CRLF & _ "</div></span>" Local $sSubst = ";" Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst) MsgBox($MB_SYSTEMMODAL, "Result", $sResult)

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