Regular Expressions 101

Save & Manage Regex

  • Current Version: 4
  • 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
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
Processing...

Test String

Code Generator

Generated Code

#include <StringConstants.au3> ; to declare the Constants of StringRegExp #include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate Local $sRegex = "(?m)^((\.{2}\\)+|(\.?\\)?).+[^:\r\n]$" Local $sString = "Directories:" & @CRLF & _ "" & @CRLF & _ "\\Reports\Test\\Test" & @CRLF & _ "..\meeting_minutes" & @CRLF & _ "..\..\profile" & @CRLF & _ "Reports\2023\summary" & @CRLF & _ "\Reports\2023\summary" & @CRLF & _ ".\Reports\2023\summary" & @CRLF & _ "..\Projects\project_a" & @CRLF & _ "..\Projects\project a" & @CRLF & _ "..\Projects\..\.\project\.\..\a" & @CRLF & _ ".\my_file" & @CRLF & _ "..\Music#a\file" & @CRLF & _ "..\Music[Genre]\file" & @CRLF & _ "..\Music(Genre)\file" & @CRLF & _ "..\Music-Hardcore-Metal\file" & @CRLF & _ "..\Documents\My+File" & @CRLF & _ "..\Documents\Some{Document}" & @CRLF & _ "..\Files\Afilewithweird;Characters'`" & @CRLF & _ "..\Music#^@!()-+{};',.`~a\file" & @CRLF & _ "." & @CRLF & _ "..\" & @CRLF & _ "..\.." & @CRLF & _ "..\..\" & @CRLF & _ "\\Reports\Test\\Test" & @CRLF & _ "..\..\Final" & @CRLF & _ ".\..\Test" & @CRLF & _ ".\..\Test\" & @CRLF & _ "..\..\.\Final\..\Shapefiles\.\Landuse" & @CRLF & _ "..\..\.\Final\..\Shapefiles\.\Landuse\" & @CRLF & _ "..\..\data" & @CRLF & _ "./data-files/geological/EQs_last_week_of_2021.csv../data-files/geological/" & @CRLF & _ "EQs_last_week_of_2021.csv../../data-files/EQs_last_week_of_2021.csv../../../data-files/" & @CRLF & _ "media\🎵 music\lo-fi & chill\set_03 (remastered)" & @CRLF & _ "..\..\data\[raw]_input_🧪\test-sample(01)" & @CRLF & _ "src\core.modules\engine@v4" & @CRLF & _ "docs\2025_06\📝meeting_notes (draft)\summary" & @CRLF & _ "docs\2025_06\📝meeting_notes (draft)\summary\" & @CRLF & _ "Files\" & @CRLF & _ "Files" & @CRLF & _ "EQs_last_week_of_2021.csv../../../data-files/geological/EQs_last_week_of_2021" & @CRLF & _ "../pictures/file" & @CRLF & _ ".\temp\[backup]_2024\final-version (2)" & @CRLF & _ "assets\images\new.logo-2025_v2\icon@2x#1" & @CRLF & _ "..\users\username\Documents (Archived)\plan[final]" & @CRLF & _ "projects\#active-clients\ACME_Corp\Q2 Report\summary v1.3\" & @CRLF & _ "config\env-settings\!urgent" & @CRLF & _ "media\🎵 music\lo-fi & chill\set_03 (remastered)" & @CRLF & _ "..\..\data\[raw]_input_🧪\test-sample(01)" & @CRLF & _ "src\core.modules\engine@v4" & @CRLF & _ "docs\2025_06\meeting_notes (draft)\📝summary_notes" & @CRLF & _ "themes\🌑 darkmode (beta)\style-final!" & @CRLF & _ "..\..\logs\🪵 log-archive\2023-12-25Christmas" & @CRLF & _ "..\..\logs\🪵 log-archive\2023-12-25[Christmas]" & @CRLF & _ "..\..\logs\🪵 log-archive\2023-12-25 [Christmas]" & @CRLF & _ "downloads\zips\patch_update v34-final!" & @CRLF & _ "build\#output$\v2.1.1\installer(64bit)" & @CRLF & _ "components\UI-Toolkit_🔥\modaldialog" & @CRLF & _ "scripts\batch jobs\cleanup-temp_files!" & @CRLF & _ "resources\📁 static\fonts\Roboto_Bold-Italic" & @CRLF & _ "tests\[integration]_suite#2\test-case(01)" & @CRLF & _ "temp\$$merge_conflict\attempt_#3\resolved✅" & @CRLF & _ "locales\en-US\messages(v1" & @CRLF & _ "backup\[legacy]_configs\1999" & @CRLF & _ "src\modules\@internal\storage-handler" & @CRLF & _ "..\releases\build#2025.06.14\installer-vFinal" & @CRLF & _ "app\#dev[tools]\init" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Files:" & @CRLF & _ "..\users\username\Documents (Archived)\plan[final]\theplan.txt" & @CRLF & _ "projects\#active-clients\ACME_Corp\Q2 Report\summary v1.3\summary.txt" & @CRLF & _ "config\env-settings\!urgent\OVERVIEW.XLSX" & @CRLF & _ "media\🎵 music\lo-fi & chill\set_03 (remastered)\Cool Song.mp3" & @CRLF & _ "..\..\data\[raw]_input_🧪\test-sample(01)\Sample.db" & @CRLF & _ "src\core.modules\engine@v4\engine.exe" & @CRLF & _ "docs\2025_06\meeting_notes (draft)\📝summary_notes.txt" & @CRLF & _ "themes\🌑 darkmode (beta)\style-final!.update" & @CRLF & _ "build\#output$\v2.1.1\installer(64bit)\install_x64.msi" & @CRLF & _ "resources\📁 static\fonts\Roboto_Bold-Italic.ttf" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH) Local $aFullArray[0] For $i = 0 To UBound($aArray) -1 _ArrayConcatenate($aFullArray, $aArray[$i]) Next $aArray = $aFullArray ; Present the entire match result _ArrayDisplay($aArray, "Result")

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