Regular Expressions 101

Save & Share

  • Regex Version: ver. 27
  • 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
No Match

/
/
gm

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)(?<=\n)[A-Za-z ]{4,44}\s(\d{3}|\d{1}\w{2})" Local $sString = "ROBERTO S.R.L. " & @CRLF & _ "Automotive Aftermarket" & @CRLF & _ "Roberto S.R.L., Str. Horia Macelariu nr. 30-34, RO-013937 Bucuresti" & @CRLF & _ "Capitalul Social: 169.363.000 Lei, Nr. Ord. Reg. com.: J40/7601/1994 " & @CRLF & _ " " & @CRLF & _ "Citibank Europe Plc Dublin, Romania Branch Citibank Europe Plc Dublin, Bulgaria Branch " & @CRLF & _ "SWIFT CODE: CITIROBU SWIFT CODE: CITIBGSF " & @CRLF & _ "IBAN RON: RO45 CITI 0000 0007 2488 3001 IBAN BGN: BG54 CITI 9250 1001 0086 00 " & @CRLF & _ "IBAN EURO: RO48 CITI 0000 0007 2488 3044" & @CRLF & _ "Invoice 1/ 2" & @CRLF & _ "Document No.: 2045175575" & @CRLF & _ "Date: 09.01.2023" & @CRLF & _ "Sold To party: 22222222" & @CRLF & _ "Account No.: 22222222" & @CRLF & _ "ALFREDO GIOACCHINO OOD " & @CRLF & _ "ul. Andrey Germanov 11 " & @CRLF & _ "BG-1336 MILANO" & @CRLF & _ "Your VAT No.: BG175423111" & @CRLF & _ "Our VAT No.: RO5541546" & @CRLF & _ "Contact Person Finance: VALENTINA IVANOVA" & @CRLF & _ "Phone: +35929601062" & @CRLF & _ "E-mail: Valentina.Ivanova@bg.rocco.com" & @CRLF & _ "Contacts: DIANA DOBREVA" & @CRLF & _ "Phone: 878668802" & @CRLF & _ "E-mail: external.Diana.Dobreva@bg.rocco.com" & @CRLF & _ "Sold To Address: ALFREDO GIOACCHINO OOD, ul. Andrey Germanov 11, BG-1336 MILANO, B" & @CRLF & _ "Item Material/Description Quantity Unit Price per unit Net Value BGN" & @CRLF & _ "Transport: 1180774272 Shipping Point: ADC/LDC DE, Karlsruhe Shipping Type: Truck" & @CRLF & _ "Ship To Party: 95100938 ALFREDO GIOACCHINO OOD " & @CRLF & _ "ul. Andrey Germanov 11 " & @CRLF & _ "BG-1336 SOFIA" & @CRLF & _ "Delivery No.: 823025507 Delivery Date: 13.01.2023 Delivery Type: Standard Order AA" & @CRLF & _ "Your Order No.: 20230103-154257-011O From: 03.01.2023 Our Order No.: 210492510" & @CRLF & _ "10 Nozzle And Holder Assy 2 EA" & @CRLF & _ "Material: 0.432.231.664.80C" & @CRLF & _ "Material Entered: 0.432.231.664" & @CRLF & _ "EAN: 3165143215791" & @CRLF & _ "179,20 358,40" & @CRLF & _ "Dispatch element: 106650185 2 EA" & @CRLF & _ "20 Hole-Type Nozzle 4 EA" & @CRLF & _ "Material: 0.433.171.193.8GA" & @CRLF & _ "Material Entered: 0.433.171.193" & @CRLF & _ "EAN: 4047024542822" & @CRLF & _ "33,99 135,96" & @CRLF & _ "Dispatch element: 106650185 4 EA" & @CRLF & _ "Total net value: 494,36" & @CRLF & _ "VAT:* Z9 0,00 % 494,36 0,00" & @CRLF & _ "Invoice amount: 494,36" & @CRLF & _ "* Triangular transaction taxable at the customer according to Art. 141,2006/112/EC. This document is legally binding without signature." & @CRLF & _ "Incoterms: DAP SOFIA" & @CRLF & _ "Payment terms: Up to 23.01.2023 you receive 2,000 % discount" & @CRLF & _ "Up to 08.02.2023 without deduction" & @CRLF & _ "Country of origin Index (represents the last three digits of part number)" & @CRLF & _ "Brazil 8GA" & @CRLF & _ "India 80CROBERTO S.R.L. " & @CRLF & _ "Automotive Aftermarket" & @CRLF & _ "Robert Bosch S.R.L., Str. Horia Macelariu nr. 30-34, RO-013937 Bucuresti" & @CRLF & _ "Capitalul Social: 169.363.000 Lei, Nr. Ord. Reg. com.: J40/7601/1994 " & @CRLF & _ " " & @CRLF & _ "Citibank Europe Plc Dublin, Romania Branch Citibank Europe Plc Dublin, Bulgaria Branch " & @CRLF & _ "SWIFT CODE: CITIROBU SWIFT CODE: CITIBGSF " & @CRLF & _ "IBAN RON: RO45 CITI 0000 0007 2488 3001 IBAN BGN: BG54 CITI 9250 1001 0086 00 " & @CRLF & _ "IBAN EURO: RO48 CITI 0000 0007 2488 3044" & @CRLF & _ "Invoice 2/ 2" & @CRLF & _ "Document No.: 2045175575" & @CRLF & _ "Date: 09.01.2023" & @CRLF & _ "Sold To party: 95100938" & @CRLF & _ "Account No.: 95100938" & @CRLF & _ "Country of origin HS Code Quantity UoM Amount BGN" & @CRLF & _ "Brazil" & @CRLF & _ "84099900 4 EA 135,96" & @CRLF & _ "135,96" & @CRLF & _ "India" & @CRLF & _ "84099900 2 EA 358,40" & @CRLF & _ "358,40" & @CRLF & _ "Marking Dispatch element type Physical dimension of dispatch " & @CRLF & _ "element" & @CRLF & _ "Unit of " & @CRLF & _ "measure" & @CRLF & _ "Gross " & @CRLF & _ "Weight Unit of measure" & @CRLF & _ "106650185 Corrugated carton 246 166 123 MM 0,959 KG" & @CRLF & _ "Country of origin Item numbers Total amount" & @CRLF & _ "Brazil 20 135,96" & @CRLF & _ "India 10 358,40" & @CRLF & _ "Element type: Corrugated carton Number of elements: 1 0,959 KG" 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