Regular Expressions 101

Save & Share

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)"[a-zA-Z0-9 -\/\[\]_:.\(\)@\"\-,]*",|["[a-zA-Z0-9 -\/\[\]_:.\(\)@\"\-,]*"],|}," Local $sString = "{" & @CRLF & _ ""slug": "submit/82276720931155/"," & @CRLF & _ ""file_server": "go-sub3"," & @CRLF & _ ""temp_upload": {" & @CRLF & _ ""q95_input95": ["iShares-Fund-Changes-June-2018-vF.PDF"]" & @CRLF & _ "}," & @CRLF & _ ""q44_gi_LegalEntityName": "Test 96"," & @CRLF & _ ""q43_gi_Address": {" & @CRLF & _ ""addr_line1": "96"," & @CRLF & _ ""addr_line2": ""," & @CRLF & _ ""city": "New York"," & @CRLF & _ ""state": "NY"," & @CRLF & _ ""postal": "10096"," & @CRLF & _ ""country": "United States"" & @CRLF & _ "}," & @CRLF & _ ""q45_gi_PhoneNumber": {" & @CRLF & _ ""full": "(969) 696-9696"" & @CRLF & _ "}," & @CRLF & _ ""q47_gi_FaxNumber": {" & @CRLF & _ ""full": """ & @CRLF & _ "}," & @CRLF & _ ""q48_gi_CompanyWebsite": ""," & @CRLF & _ ""q49_gi_DateOfIncorporation": {" & @CRLF & _ ""year": ""," & @CRLF & _ ""month": ""," & @CRLF & _ ""day": """ & @CRLF & _ "}," & @CRLF & _ ""q50_gi_StateOfIncorporation": {" & @CRLF & _ ""addr_line1": ""," & @CRLF & _ ""addr_line2": ""," & @CRLF & _ ""city": ""," & @CRLF & _ ""state": ""," & @CRLF & _ ""postal": ""," & @CRLF & _ ""country": """ & @CRLF & _ "}," & @CRLF & _ ""q51_gi_TaxID": "96"," & @CRLF & _ ""q58_gi_RegulatoryAuth": ""," & @CRLF & _ ""q59_gi_LeiNumber": ""," & @CRLF & _ ""q60_gi_LargeTraderID": ""," & @CRLF & _ ""q62_gi_ComplianceContact": {" & @CRLF & _ ""first": ""," & @CRLF & _ ""last": """ & @CRLF & _ "}," & @CRLF & _ ""q64_gi_ComplianceEmail": ""," & @CRLF & _ ""q63_gi_CompliancePhoneNumber": {" & @CRLF & _ ""full": """ & @CRLF & _ "}," & @CRLF & _ ""q67_gi_IsSubsidiaryName": ""," & @CRLF & _ ""q68_gi_IsSubsidiaryAddress": ""," & @CRLF & _ ""q69_gi_IsSubsidiaryJurisdiction": ""," & @CRLF & _ ""q70_gi_IsSubsidiaryRegulator": ""," & @CRLF & _ ""q75_sc_OpsContact": {" & @CRLF & _ ""first": ""," & @CRLF & _ ""last": """ & @CRLF & _ "}," & @CRLF & _ ""q77_sc_OpsEmail": ""," & @CRLF & _ ""q76_sc_OpsPhone": {" & @CRLF & _ ""full": """ & @CRLF & _ "}," & @CRLF & _ ""q80_sc_OmgeoAcronym": ""," & @CRLF & _ ""q81_sc_OmgeoAccessCode": ""," & @CRLF & _ ""q82_sc_DTCNumber": ""," & @CRLF & _ ""q83_sc_MPID": ""," & @CRLF & _ ""q84_sc_AgentBankNumber": ""," & @CRLF & _ ""q85_sc_InternalAccountNumber": ""," & @CRLF & _ ""q86_sc_InstDelivery": ""," & @CRLF & _ ""q87_sc_InterestedPartyID": ""," & @CRLF & _ ""q88_sc_Custodian": ""," & @CRLF & _ ""q89_sc_Euroclear": ""," & @CRLF & _ ""q90_sc_Cedel": ""," & @CRLF & _ ""q92_sc_ConfirmsEmail": ""," & @CRLF & _ ""q101_ct_InstitutionalDVP": {" & @CRLF & _ ""other": """ & @CRLF & _ "}," & @CRLF & _ ""q102_ct_InstitutionalDVPTypePublicDescription": ""," & @CRLF & _ ""q108_ct_SectionA": ["Trust Co."]," & @CRLF & _ ""q114_ct_SectionC": {" & @CRLF & _ ""other": """ & @CRLF & _ "}," & @CRLF & _ ""q116_id_SectionA": {" & @CRLF & _ ""0": "For a corporation, a Corporate Resolution and, if available, incorporation documents such as Articles of Incorporation and By-Laws"," & @CRLF & _ ""other": """ & @CRLF & _ "}," & @CRLF & _ ""q121_ac_ControllingCustomerRelationship": ""," & @CRLF & _ ""q123_ac_RegulatorBeneficialOwner": "No"," & @CRLF & _ ""q125_ac_AccountBase": ""," & @CRLF & _ ""q130_ac_CommercialEntity": ""," & @CRLF & _ ""q132_ac_CommercialEntityOutsideUSFundsCountry": {" & @CRLF & _ ""addr_line1": ""," & @CRLF & _ ""addr_line2": ""," & @CRLF & _ ""city": ""," & @CRLF & _ ""state": ""," & @CRLF & _ ""postal": ""," & @CRLF & _ ""country": """ & @CRLF & _ "}," & @CRLF & _ ""q152_ac_ConfirmNeitherPrivBank": {" & @CRLF & _ ""other": """ & @CRLF & _ "}," & @CRLF & _ ""q138_ac_CustomerRelationship": "Hi"," & @CRLF & _ ""q161_signature": "Signed by David Test (dd@brownstone.com)"," & @CRLF & _ ""q56_approvalStatus": ""," & @CRLF & _ ""q159_ip": ""," & @CRLF & _ ""q57_typeA": "https://form.jotform.com/82276720931155"," & @CRLF & _ ""event_id": "1537887682362_82276720931155_ZPG71XZ"," & @CRLF & _ ""q66_gi_IsSubsidiary": ""," & @CRLF & _ ""q78_sc_Omgeo": ""," & @CRLF & _ ""q91_sc_Confirms": ""," & @CRLF & _ ""q97_sc_StructuredSecurities": ""," & @CRLF & _ ""q98_sc_StructuredSecuritiesUnderstand": ""," & @CRLF & _ ""q105_ct_MunicipalEntity": ""," & @CRLF & _ ""q109_ct_SectionA2": ""," & @CRLF & _ ""q111_ct_SectionB": ""," & @CRLF & _ ""q112_ct_SectionBRelyingAdviser": ""," & @CRLF & _ ""q120_ac_ControllingCustomer": ""," & @CRLF & _ ""q126_ac_AMLProgram": ""," & @CRLF & _ ""q128_ac_AMLRepresentationType": ""," & @CRLF & _ ""q131_ac_CommercialEntityOutsideUSFunds": ""," & @CRLF & _ ""q133_ac_CommercialEntityOutsideUSPresence": ""," & @CRLF & _ ""q134_ac_CommercialEntityOutsideUSServiceShellBanks": ""," & @CRLF & _ ""q157_id_SectionANA": ""," & @CRLF & _ ""input95": ["https://www.jotform.com/uploads/ddinner/82276720931155/4136970043522095790/iShares-Fund-Changes-June-2018-vF.PDF"]" & @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