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

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @";\s*color:\s*#ff+;"; string substitution = @";"; string input = @"<span id=""JobDescCKEditor"" class=""JobDescCKEditor""><div class=""sVx81""style=""color: #222222; font-size: 14px;""> <div class=""OghIW""> <div class=""sH3zFd""> <h2 class=""KLsYvd"" style=""font-size: 30px;"" tabindex=""-1"">Dot Net Developer/Senior Developer/Lead</h2> <div class=""MpVvlf sb-unsaved"">&nbsp;</div> <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> <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> </div> <div class=""iGy6ud""> <div class=""ZUeoqc""> <div style=""font-size: 20px;""> <div class=""EtwWxe"" style=""color: #ffffff;"" aria-hidden=""true"">I</div> </div> </div> <div class=""tJ9zfc"" style=""color: rgba(0, 0, 0, 0.54); font-size: 14px;""> <div class=""nJlQNd sMzDkb"">Impiger Technologies</div> <div class=""sMzDkb"">Coimbatore, Tamil Nadu</div> </div> </div> </div> </div> <div class=""GfgB1"" style=""color: #222222; font-size: 14px;"" data-ved=""0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQn-cDCIEIMAA"">&nbsp;</div> <div class=""mR2gOd"" data-hveid=""1027"" data-ved=""0ahUKEwiC8vy606bsAhVl7HMBHfHOA9gQ890CCIMIMAA""> <div class=""EDblX DAVP1""> <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> <div class=""B8oxKe BQC79e"" data-jsdata=""> <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> </div> </div> </div> <div class=""CyxPy EPhEaf"" style=""color: #ffffff;"">&nbsp;</div> <div>&nbsp;</div> <div>&nbsp;</div> <div class=""w5NUMb"" style=""color: #222222; font-size: 14px;"">&nbsp;</div> <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> <div class=""YgLbBe"" style=""color: rgba(0, 0, 0, 0.87); font-size: 14px;""> <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> </div> <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""> <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> <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> </div> <div class=""gWhMmc"" style=""color: #222222; font-size: 14px;"" data-jsdata=""> <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""> <div id=""gws-plugins-horizon-jobs__salary""> <div class=""iE9pwb""> <div class=""XdTbkf""> <div class=""bKLZtb BAgzfc"" style=""color: rgba(0, 0, 0, 0.87);"">Salary comparison</div> <div class=""URn80""> <div class=""HWnzvc"" aria-label=""More info"">&nbsp;</div> </div> </div> <div> <div class=""ZDG8hb"" style=""color: rgba(0, 0, 0, 0.54); font-size: 12px;""> <div class=""UcFhic""> <div class=""fjnW5b GPnHhd"">&nbsp;</div> Impiger Technologies</div> <div class=""UcFhic""> <div class=""ZZ1t4d GPnHhd"">&nbsp;</div> Local employers via&nbsp;<a class=""aPBtBe"" style=""color: #4285f4;"" target=""_blank"" rel=""noopener"">PayScale</a></div> </div> <div class=""zrUdLc"">&nbsp;160k&nbsp;420k&nbsp;680k?2L–900k?2.2L–530k</div> </div> </div> </div> </div> </div> <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> <div class=""AtCEfb"" style=""color: #222222; font-size: 14px;color: #ffffff;"" data-jsdata=""> <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""> <div> <div class=""gaLgbc""> <div class=""qySoyb"" style=""color: rgba(0, 0, 0, 0.87); font-size: 14px;background-color: #ffffff"">Glassdoor</div> </div> </div> </div> </div></span>"; RegexOptions options = RegexOptions.Multiline; 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