Regular Expressions 101

Save & Manage Regex

  • Current Version: 1
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
Sponsors
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 single character of: a, b, c or d
    [[ab][cd]]
  • 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]
  • Character class intersection
    [\w&&[^\d]]
  • 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
Processing...

Test String

Code Generator

Generated Code

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @"mat-column-(\w+)[^>]*>(?:<[^>]*>)*([^<]*)"; string input = @"<mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""6%"" fxlayoutalign=""left center"" class=""mat-cell cdk-cell cdk-column-status mat-column-status ng-star-inserted"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 6%;""><mat-icon _ngcontent-ifd-c336="" role=""img"" class=""mat-icon notranslate mat-tooltip-trigger material-icons app-list-icon-yellow mat-icon-no-color"" aria-hidden=""true"" data-mat-icon-type=""font"" aria-describedby=""cdk-describedby-message-1"" cdk-describedby-host=""> info </mat-icon><!----><!----></mat-cell><mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""8%"" fxlayoutalign=""left center"" class=""mat-cell cdk-cell cdk-column-taskObjectExternalId mat-column-taskObjectExternalId ng-star-inserted"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 8%;""><a _ngcontent-ifd-c336="" href=""/applications/tab/customer-tab?id=103085""> 101010 </a></mat-cell><mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""12%"" fxlayoutalign=""left center"" class=""mat-cell cdk-cell cdk-column-type mat-column-type ng-star-inserted"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 12%;""><section _ngcontent-ifd-c336="" fxflex=""100%"" fxlayout=""row wrap"" style=""flex-flow: wrap; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 100%;""><span _ngcontent-ifd-c336="" fxflex=""100%"" fxlayoutalign=""left center"" class=""extra-info"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 100%;""> WBSO 2023 </span><span _ngcontent-ifd-c336="" fxflex=""100%"" fxlayoutalign=""left center"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 100%;""> Customer approval <!----><!----></span></section></mat-cell><mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""15%"" fxlayoutalign=""left center"" class=""mat-cell cdk-cell cdk-column-customerName mat-column-customerName ng-star-inserted"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 15%;""> Example customer </mat-cell><mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""10%"" fxlayoutalign=""left center"" class=""mat-cell cdk-cell cdk-column-creationDate mat-column-creationDate ng-star-inserted"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 10%;""> 16 Days ago </mat-cell><mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""10%"" fxlayoutalign=""left center"" class=""mat-cell cdk-cell cdk-column-deadLine mat-column-deadLine ng-star-inserted"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 10%;""><!----><span _ngcontent-ifd-c336="" class=""ng-star-inserted""> 4 Days left </span><!----><!----><!----><!----><!----></mat-cell><mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""10%"" fxlayoutalign=""left center"" class=""mat-cell cdk-cell cdk-column-createdBy mat-column-createdBy ng-star-inserted"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 10%;""> </mat-cell><mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""8%"" fxlayoutalign=""left center"" class=""mat-cell cdk-cell cdk-column-reminderSent mat-column-reminderSent ng-star-inserted"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 8%;""> 0 </mat-cell><mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""8%"" fxlayoutalign=""left center"" class=""mat-cell cdk-cell cdk-column-lastModifiedDate mat-column-lastModifiedDate ng-star-inserted"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 8%;""> </mat-cell><mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""7%"" fxlayoutalign=""left center"" class=""mat-cell cdk-cell cdk-column-visible mat-column-visible ng-star-inserted"" style=""place-content: center flex-start; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 7%;""><mat-icon _ngcontent-ifd-c336="" role=""img"" class=""mat-icon notranslate material-icons mat-icon-no-color ng-star-inserted"" aria-hidden=""true"" data-mat-icon-type=""font""> visibility_on </mat-icon><!----><!----></mat-cell><mat-cell _ngcontent-ifd-c336="" role=""cell"" fxflex=""5%"" fxlayoutalign=""end center"" class=""mat-cell cdk-cell cdk-column-actions mat-column-actions ng-star-inserted"" style=""place-content: center flex-end; align-items: center; flex-direction: row; box-sizing: border-box; display: flex; flex: 1 1 100%; max-width: 5%;""><button _ngcontent-ifd-c336="" mat-icon-button="" class=""mat-focus-indicator mat-menu-trigger mat-icon-button mat-button-base"" aria-haspopup=""true""><span class=""mat-button-wrapper""><mat-icon _ngcontent-ifd-c336="" role=""img"" class=""mat-icon notranslate material-icons mat-icon-no-color"" aria-hidden=""true"" data-mat-icon-type=""font"">settings</mat-icon></span><span matripple="" class=""mat-ripple mat-button-ripple mat-button-ripple-round""></span><span class=""mat-button-focus-overlay""></span></button><!----><mat-menu _ngcontent-ifd-c336="" class=""ng-star-inserted""><!----></mat-menu></mat-cell><!---->"; RegexOptions options = RegexOptions.Multiline; foreach (Match m in Regex.Matches(input, pattern, options)) { Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index); } } }

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