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
  • 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

/
/
gm

Test String

Substitution

Processing...

Code Generator

Generated Code

#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox Local $sRegex = "(?m)(\<li\>\<a target.+?\>)(.+)(\<\/a\>\<\/li\>)" Local $sString = "Функция Blue" & @CRLF & _ "Функция ChrW [VBA]" & @CRLF & _ "Функция CreateUnoDialog" & @CRLF & _ "Функция CurDir" & @CRLF & _ "Функция Дата" & @CRLF & _ "Функция DateSerial" & @CRLF & _ "Функция DateValue" & @CRLF & _ "Функция Day" & @CRLF & _ "Функция DDB [VBA]" & @CRLF & _ "Функция Dir" & @CRLF & _ "Функция Eof" & @CRLF & _ "Функции обработки ошибок" & @CRLF & _ "Функция FileAttr" & @CRLF & _ "Функция FileDateTime" & @CRLF & _ "Функция FileExists" & @CRLF & _ "Функция FileLen" & @CRLF & _ "Функция FormatDateTime [VBA]" & @CRLF & _ "Функция FormatNumber [VBA]" & @CRLF & _ "Функция FreeFile" & @CRLF & _ "Функция FV [VBA]" & @CRLF & _ "Функция GetAttr" & @CRLF & _ "Функция Green" & @CRLF & _ "Функция InStrRev [VBA]" & @CRLF & _ "Функция Input [VBA]" & @CRLF & _ "Функция InputBox" & @CRLF & _ "Функция IPmt [VBA]" & @CRLF & _ "Функция IRR [VBA]" & @CRLF & _ "Функция Loc" & @CRLF & _ "Функция Lof" & @CRLF & _ "Функция MIRR [VBA]" & @CRLF & _ "Функция Month" & @CRLF & _ "Функция MonthName [VBA]" & @CRLF & _ "Функция NPer [VBA]" & @CRLF & _ "Функция NPV [VBA]" & @CRLF & _ "Числовые функции" & @CRLF & _ "Функция Pmt [VBA]" & @CRLF & _ "Функция PPmt [VBA]" & @CRLF & _ "Функция PV [VBA]" & @CRLF & _ "Функция QBColor" & @CRLF & _ "Функция Rate [VBA]" & @CRLF & _ "Функция Red" & @CRLF & _ "Функция RGB" & @CRLF & _ "Функция RGB [VBA]" & @CRLF & _ "Функция Round [VBA]" & @CRLF & _ "Функция Seek" & @CRLF & _ "Функция SLN [VBA]" & @CRLF & _ "Функция StrConv [VBA]" & @CRLF & _ "Функция StrReverse [VBA]" & @CRLF & _ "Функция SYD [VBA]" & @CRLF & _ "Функция WeekDay" & @CRLF & _ "Функция WeekdayName [VBA]" Local $sSubst = "$2" 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