Regular Expressions 101

Save & Share

  • Regex Version: ver. 1
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

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

$re = '/(text\d+).Text\s*=\s*(".+?")\s*;/'; $str = ' runProperties62.Append(fontSize70); runProperties62.Append(fontSizeComplexScript70); Text text62 = new Text(){ Space = SpaceProcessingModeValues.Preserve }; text62.Text = "Приемка "; run62.Append(runProperties62); run62.Append(text62); Run run63 = new Run(){ RsidRunProperties = "00A95F02", RsidRunAddition = "00D53943" }; RunProperties runProperties63 = new RunProperties(); FontSize fontSize71 = new FontSize(){ Val = "18" }; FontSizeComplexScript fontSizeComplexScript71 = new FontSizeComplexScript(){ Val = "18" }; runProperties63.Append(fontSize71); runProperties63.Append(fontSizeComplexScript71); Text text63 = new Text(); text63.Text = "и оценка оказанных услуг"; run63.Append(runProperties63); run63.Append(text63); Run run64 = new Run(){ RsidRunProperties = "00A95F02" }; RunProperties runProperties64 = new RunProperties(); FontSize fontSize72 = new FontSize(){ Val = "18" }; FontSizeComplexScript fontSizeComplexScript72 = new FontSizeComplexScript(){ Val = "18" }; runProperties64.Append(fontSize72); runProperties64.Append(fontSizeComplexScript72); Text text64 = new Text(){ Space = SpaceProcessingModeValues.Preserve }; text64.Text = " про"; run64.Append(runProperties64); run64.Append(text64); Run run65 = new Run(){ RsidRunProperties = "00A95F02", RsidRunAddition = "00D53943" }; RunProperties runProperties65 = new RunProperties(); FontSize fontSize73 = new FontSize(){ Val = "18" }; FontSizeComplexScript fontSizeComplexScript73 = new FontSizeComplexScript(){ Val = "18" }; runProperties65.Append(fontSize73); runProperties65.Append(fontSizeComplexScript73); Text text65 = new Text(); text65.Text = "изводится по акту сдачи-приемки"; run65.Append(runProperties65); run65.Append(text65); Run run66 = new Run(){ RsidRunProperties = "00A95F02" }; RunProperties runProperties66 = new RunProperties(); FontSize fontSize74 = new FontSize(){ Val = "18" }; FontSizeComplexScript fontSizeComplexScript74 = new FontSizeComplexScript(){ Val = "18" }; runProperties66.Append(fontSize74); runProperties66.Append(fontSizeComplexScript74); Text text66 = new Text(); text66.Text = "."; run66.Append(runProperties66); run66.Append(text66); paragraph8.Append(paragraphProperties8); paragraph8.Append(run62); paragraph8.Append(run63); paragraph8.Append(run64); paragraph8.Append(run65); paragraph8.Append(run66); Paragraph paragraph9 = new Paragraph(){ RsidParagraphMarkRevision = "00A95F02", RsidParagraphAddition = "008E08D4", RsidParagraphProperties = "008E08D4", RsidRunAdditionDefault = "00224D41" }; ParagraphProperties paragraphProperties9 = new ParagraphProperties(); NumberingProperties numberingProperties4 = new NumberingProperties(); NumberingLevelReference numberingLevelReference4 = new NumberingLevelReference(){ Val = 1 }; NumberingId numberingId4 = new NumberingId(){ Val = 9 }; numberingProperties4.Append(numberingLevelReference4); numberingProperties4.Append(numberingId4); Justification justification5 = new Justification(){ Val = JustificationValues.Both }; ParagraphMarkRunProperties paragraphMarkRunProperties9 = new ParagraphMarkRunProperties(); FontSize fontSize75 = new FontSize(){ Val = "18" }; FontSizeComplexScript fontSizeComplexScript75 = new FontSizeComplexScript(){ Val = "18" }; paragraphMarkRunProperties9.Append(fontSize75); paragraphMarkRunProperties9.Append(fontSizeComplexScript75); paragraphProperties9.Append(numberingProperties4); paragraphProperties9.Append(justification5); paragraphProperties9.Append(paragraphMarkRunProperties9); Run run67 = new Run(){ RsidRunProperties = "00A95F02" }; RunProperties runProperties67 = new RunProperties(); FontSize fontSize76 = new FontSize(){ Val = "18" }; FontSizeComplexScript fontSizeComplexScript76 = new FontSizeComplexScript(){ Val = "18" }; runProperties67.Append(fontSize76); runProperties67.Append(fontSizeComplexScript76); Text text67 = new Text(); text67.Text = "Исполнитель"; run67.Append(runProperties67); run67.Append(text67); Run run68 = new Run(){ RsidRunProperties = "00A95F02", RsidRunAddition = "008E08D4" }; RunProperties runProperties68 = new RunProperties(); FontSize fontSize77 = new FontSize(){ Val = "18" }; FontSizeComplexScript fontSizeComplexScript77 = new FontSizeComplexScript(){ Val = "18" }; runProperties68.Append(fontSize77); runProperties68.Append(fontSizeComplexScript77); Text text68 = new Text(){ Space = SpaceProcessingModeValues.Preserve }; text68.Text = " обязуется "; run68.Append(runProperties68); run68.Append(text68); Run run69 = new Run(){ RsidRunProperties = "00A95F02", RsidRunAddition = "00884844" }; RunProperties runProperties69 = new RunProperties(); FontSize fontSize78 = new FontSize(){ Val = "18" }; FontSizeComplexScript fontSizeComplexScript78 = new FontSizeComplexScript(){ Val = "18" }; runProperties69.Append(fontSize78); runProperties69.Append(fontSizeComplexScript78); Text text69 = new Text(); text69.Text = "оказать услуги";'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); // Print the entire match result var_dump($matches);

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 PHP, please visit: http://php.net/manual/en/ref.pcre.php