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

/
/
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)(?<=\((No.\)) : )(.+)" Local $sString = "CÔNG TY TNHH GRAB" & @CRLF & _ "Địa chỉ (Address) :Tòa nhà Mapletree Business Centre, 1060 Nguyễn Văn Linh, Phường Tân Phong, Quận 7," & @CRLF & _ "Thành phố Hồ Chí Minh, Việt Nam" & @CRLF & _ "Mã số thuế (Tax code) :0 3 1 2 6 5 0 4 3 7" & @CRLF & _ "" & @CRLF & _ "HÓA ĐƠN GIÁ TRỊ GIA TĂNG" & @CRLF & _ "(VAT INVOICE) Ký hiệu (Serial) : 1C22TGN" & @CRLF & _ "Ngày (Date) 23 tháng (month) 05 năm (year) 2022 Số (No.) : 1117609" & @CRLF & _ " " & @CRLF & _ "Mã của CQT: 00AD14CC7603364466BF60F761D05D6A13" & @CRLF & _ "" & @CRLF & _ "Họ tên người mua hàng (Customer's name) :" & @CRLF & _ "(Xuất bởi phần mềm EInvoice, Công ty TNHH Phát triển công nghệ Thái Sơn - MST: 0101300842 - www.einvoice.vn)" & @CRLF & _ "Tên đơn vị (Company) :CÔNG TY TNHH UN-AVAILABLE" & @CRLF & _ "Mã số thuế (Tax code) :0303271471" & @CRLF & _ "Địa chỉ (Address) :Một phần lô I/3 Đường số 7, Khu công nghiệp Vĩnh Lộc, Phường Bình Hưng Hòa B, Quận Bình Tân," & @CRLF & _ "TP Hồ Chí Minh, Việt Nam" & @CRLF & _ "Hình thức thanh toán (Payment term) :Chuyển khoản Số tài khoản (Bank A/C) :" & @CRLF & _ "" & @CRLF & _ "STT Tên hàng hóa, dịch vụ ĐVT Số lượng Đơn giá Thuế suất Thành tiền Tiền thuế Thành tiền" & @CRLF & _ "trước thuế" & @CRLF & _ "(No.) (Description) (Unit) (Quantity) (Unit Price) (Tax rate) (Amount exc VAT) (VAT amount) (Selling price)" & @CRLF & _ "A B C D E F G = I / (1+ F) H = I - G I" & @CRLF & _ "Cước phí vận chuyển mã" & @CRLF & _ "1 A-3ENBVDNWWJFL Chuyến 1 9.091 10% 9.091 909 10.000" & @CRLF & _ "(phần doanh thu Grab" & @CRLF & _ "được chia)" & @CRLF & _ "Cước phí vận chuyển mã" & @CRLF & _ "2 A-3ENBVDNWWJFL Chuyến 1 36.364 10% 36.364 3.636 40.000" & @CRLF & _ "(phần doanh thu của đối" & @CRLF & _ "tác vận tải)" & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ "Tổng cộng số tiền đã có thuế GTGT: 50.000" & @CRLF & _ "(Total of VAT included selling price) :" & @CRLF & _ "Tổng tiền trước thuế 10%: 45.455 Tổng tiền thuế 10%: 4.545" & @CRLF & _ "(Total of amount exc VAT 10%) (Total of VAT amount 10%)" & @CRLF & _ "Trong đó: Tổng tiền trước thuế 5%: Tổng tiền thuế 5%: " & @CRLF & _ "(in which) (Total of amount exc VAT 5%) (Total of VAT amount 5%)" & @CRLF & _ "Tổng cộng số tiền trước thuế: 45.455 Tổng tiền thuế GTGT: 4.545" & @CRLF & _ "(Total of amount exc VAT) (Total of VAT amount)" & @CRLF & _ "" & @CRLF & _ "Số tiền viết bằng chữ (Amount in words) : Năm mươi nghìn đồng" & @CRLF & _ "" & @CRLF & _ "Người mua hàng (Buyer) Người bán hàng (Seller)" & @CRLF & _ "(Ký, ghi rõ họ tên) (Ký, đóng dấu, ghi rõ họ tên)" & @CRLF & _ "(Signature & full name) (Signature, stamp & full name)" & @CRLF & _ "" & @CRLF & _ "Signature Valid " & @CRLF & _ " Ký bởi: CÔNG TY TNHH GRAB" & @CRLF & _ "Ký ngày: 23/05/2022" & @CRLF & _ "" & @CRLF & _ "Mã nhận hóa đơn (Code for checking): QIEJWLAEYGQ5 tra cứu tại (Tracking): https://vn.invoice.grab.com/" & @CRLF & _ "Ghi chú: Thành tiền (giá bán) là giá đã bao gồm thuế GTGT. (Note: Selling price is VAT included)" & @CRLF & _ "(Cần kiểm tra, đối chiếu khi lập, giao, nhận hóa đơn / Need to check, compare when making, delivering, receiving invoices)" & @CRLF & _ "Trang 1/1" 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