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

/
/
gmis

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 = "(?mis)^const labels(.*)const config = {type: 'line',data: data,options: {}};" Local $sString = "" & @CRLF & _ "<script src="/js/theme.min-1.1.js"></script><script>" & @CRLF & _ "const labels = [" & @CRLF & _ "'00:00','01:00','02:00','03:00','04:00','05:00','06:00','07:00','08:00','09:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00','24:00',];" & @CRLF & _ "const data = {" & @CRLF & _ " labels: labels," & @CRLF & _ " datasets: [{" & @CRLF & _ " stepped:true," & @CRLF & _ " label: 'Idag'," & @CRLF & _ " backgroundColor: '#357DA7'," & @CRLF & _ " borderColor: '#357DA7'," & @CRLF & _ " data: [94.24,91.59,93.52,97.70,103.23,155.15,233.20,269.03,279.92,255.87,231.30,226.70,209.64,174.65,164.84,154.16,134.04,199.48,205.03,204.88,192.49,154.16,74.40,19.47,19.47]" & @CRLF & _ " }," & @CRLF & _ " {" & @CRLF & _ " label: 'Idag snitt'," & @CRLF & _ " backgroundColor: '#fff'," & @CRLF & _ " borderColor: '#357DA7'," & @CRLF & _ " borderDash: [5, 5]," & @CRLF & _ " data: [167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,167.44,]," & @CRLF & _ " pointRadius: 0," & @CRLF & _ " borderWidth: 2" & @CRLF & _ " }" & @CRLF & _ " ,{" & @CRLF & _ " stepped:true," & @CRLF & _ " label: 'Imorgon'," & @CRLF & _ " backgroundColor: '#dd4b39'," & @CRLF & _ " borderColor: '#dd4b39'," & @CRLF & _ " data: [10.28,9.82,6.15,5.10,11.91,13.78,80.03,205.79,215.04,214.14,211.85,205.64,204.86,165.63,166.62,196.70,200.63,207.10,211.79,211.80,208.24,207.02,113.90,47.63,47.63]" & @CRLF & _ " },{" & @CRLF & _ " label: 'Imorgon snitt'," & @CRLF & _ " backgroundColor: '#fff'," & @CRLF & _ " borderColor: '#dd4b39'," & @CRLF & _ " borderDash: [5, 5]," & @CRLF & _ " data: [138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,138.81,]," & @CRLF & _ " pointRadius: 0," & @CRLF & _ " borderWidth: 2" & @CRLF & _ " } ]" & @CRLF & _ "}; " & @CRLF & _ "const config = {type: 'line',data: data,options: {}};" & @CRLF & _ "var myChart = new Chart(document.getElementById('myChart'),config);" & @CRLF & _ "</script>" 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