Regular Expressions 101

Save & Manage Regex

  • Current Version: 1
  • 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
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 = "(.?(?:FROM)\ [a-zA-Z_]+(?:\.[a-zA-Z_]+)?)" Local $sString = "SELECT sl.subscription_link_id link_data_id" & @CRLF & _ " , sl.subscription_id link_sub_id" & @CRLF & _ " , a.adoption_id link_id" & @CRLF & _ " , a.date_created link_start_date" & @CRLF & _ " , dispatches.bill_charge_id link_charge_id" & @CRLF & _ " , dispatches.total_amount link_amount" & @CRLF & _ " , dispatches.status link_charge_status" & @CRLF & _ " , dispatches.date_created link_charge_date_created" & @CRLF & _ " , dispatches.date_modified link_charge_date_modified" & @CRLF & _ " , dispatches.bill_fin_instrument_id charge_bill_fin_instrument_id" & @CRLF & _ " , dispatches.date_resolved charge_resolved" & @CRLF & _ " , dispatches.lp_exp_date charge_lp_exp_date" & @CRLF & _ " , a.date_modified link_date_modified" & @CRLF & _ " , a.date_created link_date_created" & @CRLF & _ " , dispatches.base_price_type_id link_base_price_type_id" & @CRLF & _ " , dispatches.status link_bill_charge_status" & @CRLF & _ " , CASE" & @CRLF & _ " WHEN ls.exp_date IS NOT NULL" & @CRLF & _ " THEN ls.exp_date" & @CRLF & _ " ELSE add_months(l.date_created, lp.num1 * DECODE(lp.num2,1,12,2,1) )" & @CRLF & _ " END link_end_date" & @CRLF & _ " , CASE" & @CRLF & _ " WHEN ls.exp_date IS NOT NULL" & @CRLF & _ " THEN 1" & @CRLF & _ " ELSE (lp.num1 * DECODE(lp.num2,1,12,2,1,5,0,0))" & @CRLF & _ " END link_term" & @CRLF & _ "FROM emetadata.ers_subscription_links sl" & @CRLF & _ " , emetadata.ers_adoptions a" & @CRLF & _ " , emetadata.ers_adopt_fulfillments af" & @CRLF & _ " , emetadata.ers_licenses l" & @CRLF & _ " , emetadata.ers_license_parameters lp" & @CRLF & _ " , emetadata.ers_license_slots ls" & @CRLF & _ " , (SELECT adopt_charge.bill_charge_id" & @CRLF & _ " , adopt_charge.status" & @CRLF & _ " ,adopt_charge.total_amount" & @CRLF & _ " , partitions.date_resolved" & @CRLF & _ " ,partitions.lp_exp_date" & @CRLF & _ " , adopt_charge.adoption_id" & @CRLF & _ " ,adopt_charge.date_created" & @CRLF & _ " , adopt_charge.date_modified" & @CRLF & _ " , adopt_charge.bill_fin_instrument_id" & @CRLF & _ " , adopt_charge.base_price_type_id" & @CRLF & _ " FROM" & @CRLF & _ " (SELECT bc.bill_charge_id" & @CRLF & _ " , bc.status" & @CRLF & _ " , bc.date_created" & @CRLF & _ " , bc.date_modified" & @CRLF & _ " , bc.total_amount" & @CRLF & _ " , bc.bill_fin_instrument_id" & @CRLF & _ " , acl.adoption_id" & @CRLF & _ " ,oicl.base_price_type_id" & @CRLF & _ " FROM emetadata.ersmd_adoption_charge_link acl" & @CRLF & _ " , emetadata.ers_bill_charge bc" & @CRLF & _ " , emetadata.ers_order_charge_links oicl" & @CRLF & _ " WHERE acl.charge_id = bc.bill_charge_id AND oicl.bill_charge_id = bc.bill_charge_id" & @CRLF & _ " ) adopt_charge" & @CRLF & _ " , (SELECT pcl.bill_charge_id" & @CRLF & _ " , bd.date_resolved" & @CRLF & _ " , cpi.lp_exp_date" & @CRLF & _ " FROM emetadata.ers_bill_dispatches bd" & @CRLF & _ " , emetadata.ers_charge_partitions cp" & @CRLF & _ " , emetadata.ersmd_charge_partition_info cpi" & @CRLF & _ " , emetadata.ers_part_charge_link pcl" & @CRLF & _ " WHERE cp.charge_partition_id = bd.charge_partition_id (+) AND cp.charge_partition_id=cpi.charge_partition_id(+) AND cp.charge_partition_id =" & @CRLF & _ " pcl.charge_partition_id AND cp.status = 3" & @CRLF & _ " ) partitions" & @CRLF & _ " WHERE adopt_charge.bill_charge_id = partitions.bill_charge_id (+)" & @CRLF & _ " ) dispatches" & @CRLF & _ "WHERE a.subscription_link_id = sl.subscription_link_id AND af.adoption_id = a.adoption_id AND a.adoption_id = dispatches.adoption_id (+) AND" & @CRLF & _ " af.fulfillment_target_id = l.license_id AND l.license_id = lp.license_id AND l.license_id = ls.license_id (+);" & @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