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

`
`
gms

Test String

Substitution

Processing...

Code Generator

Generated Code

#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox Local $sRegex = "(?ms)<Path Fill(?![^<>]*#898989[^<>]*/>)[^<>]*/>" Local $sString = "<Path Fill="None"" & @CRLF & _ " PathData="M244.87,363.97 L245.38,363.91 M245.38,363.91 L245.46,363.84 M245.46,363.84 L245.52,363.75 M245.52,363.75 L245.54,363.7 M245.54,363.7 L246.07,370.18 M246.07,370.18 L245.95,370.25 M245.95,370.25 L245.8,370.37 M245.8,370.37 L245.63,370.54 M245.63,370.54 L245.52,370.73 M245.52,370.73 L245.42,370.9 M245.42,370.9 L245.17,368.03 M245.17,368.03 L244.87,363.97"" & @CRLF & _ " Stroke="#898989" StrokeWidth="0.5"/>" & @CRLF & _ " <Path Fill="None"" & @CRLF & _ " PathData="M247.4,371.21 L247.49,371.16 M247.49,371.16 L247.91,371.13 M247.91,371.13 L249.74,371.01 M249.74,371.01 L252.52,370.82 M252.52,370.82 L252.72,370.83 M252.72,370.83 L252.72,370.84 M252.72,370.84 L252.71,370.89 M252.71,370.89 L252.72,370.95 M252.72,370.95 L252.75,371.38 M252.75,371.38 L251.86,371.44 M251.86,371.44 L249.62,371.63 M249.62,371.63 L247.55,371.79 M247.55,371.79 L247.51,371.35 M247.51,371.35 L247.47,371.28 M247.47,371.28 L247.42,371.22 M247.42,371.22 L247.4,371.21"" & @CRLF & _ " Stroke="#878787" StrokeWidth="0.5"/>" & @CRLF & _ " <Path Fill="None"" & @CRLF & _ " PathData="M246.46,372.67 L246.47,372.05 M246.47,372.05 L246.47,372.05 M246.47,372.05 L246.52,372.07 M246.52,372.07 L246.58,372.09 M246.58,372.09 L247.44,372.02 M247.44,372.02 L248.68,371.91 M248.68,371.91 L248.81,373 M248.81,373 L248.07,373.06 M248.07,373.06 L247.88,373.07 M247.88,373.07 L248.54,379.11 M248.54,379.11 L247.62,379.18 M247.62,379.18 L247.2,379.21 M247.2,379.21 L247.15,379.24 M247.15,379.24 L247.12,379.27 M247.12,379.27 L247.06,379.17 M247.06,379.17 L246.83,376.84 M246.83,376.84 L246.46,372.67"" & @CRLF & _ " Stroke="#898989" StrokeWidth="0.5"/>" 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