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

/
/
gms

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 = "(?ms)DbFileInput\.DbFileInput.*<Query>(.*?)<\/Query>" Local $sString = "<?xml version="1.0"?>" & @CRLF & _ "<AlteryxDocument yxmdVer="2023.2" RunE2="T">" & @CRLF & _ " <Nodes>" & @CRLF & _ " <Node ToolID="1">" & @CRLF & _ " <GuiSettings Plugin="AlteryxBasePluginsGui.DbFileInput.DbFileInput">" & @CRLF & _ " <Position x="246" y="222" />" & @CRLF & _ " </GuiSettings>" & @CRLF & _ " <Properties>" & @CRLF & _ " <Configuration>" & @CRLF & _ " <Passwords />" & @CRLF & _ " <File />" & @CRLF & _ " <FormatSpecificOptions UseDcm="true" Format="23" RecordLimit="">" & @CRLF & _ " <Query>select * " & @CRLF & _ "from "XXXX_01"."PUBLIC"."CASES_GB"</Query>" & @CRLF & _ " <TableStyle>Quoted</TableStyle>" & @CRLF & _ " <CacheData>False</CacheData>" & @CRLF & _ " <Table />" & @CRLF & _ " <SessionReadOnly>True</SessionReadOnly>" & @CRLF & _ " <ReadUncommitted>False</ReadUncommitted>" & @CRLF & _ " <Connection DcmType="ConnectionId">829c98d7-4345-4f8a-98fe-ea278c707529</Connection>" & @CRLF & _ " <NoProgress>True</NoProgress>" & @CRLF & _ " <PostSQL />" & @CRLF & _ " <PreSQLOnConfig>True</PreSQLOnConfig>" & @CRLF & _ " <PreSQL />" & @CRLF & _ " </FormatSpecificOptions>" & @CRLF & _ " </Configuration>" & @CRLF & _ " <Annotation DisplayMode="0">" & @CRLF & _ " <Name />" & @CRLF & _ " <DefaultAnnotationText>dcm:Snowflake — fmv_cred" & @CRLF & _ "Query=select * " & @CRLF & _ "from "XXXXX"....</DefaultAnnotationText>" & @CRLF & _ " <Left value="False" />" & @CRLF & _ " </Annotation>" & @CRLF & _ " <MetaInfo connection="Output">" & @CRLF & _ " <RecordInfo>" & @CRLF & _ " <Field name="claimnumber" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="chartno" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="billnumber" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="account" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="date" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Date" />" & @CRLF & _ " <Field name="caseno" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="caseid" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="patientname" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="dob" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Date" />" & @CRLF & _ " <Field name="patientphone" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="policyholder" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="policynumber" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="insurancename" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="casetypename" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="doa" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Date" />" & @CRLF & _ " <Field name="specialty" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="provider" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="billamount" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Double" />" & @CRLF & _ " <Field name="paid" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Double" />" & @CRLF & _ " <Field name="balance" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Double" />" & @CRLF & _ " <Field name="firstvisitdate" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Date" />" & @CRLF & _ " <Field name="lastvisitdate" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Date" />" & @CRLF & _ " <Field name="dos" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="days" scale="0" size="21" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="FixedDecimal" />" & @CRLF & _ " <Field name="billdate" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Date" />" & @CRLF & _ " <Field name="status" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="username" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="doctor" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="readingdoctor" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="doctorlocation" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="pomid" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="noofvisits" scale="0" size="21" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="FixedDecimal" />" & @CRLF & _ " <Field name="pomgenerateddate" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Date" />" & @CRLF & _ " <Field name="pomstampeddateone" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="billnote" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="referringdoctor" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="pomstampeddate" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="Date" />" & @CRLF & _ " <Field name="billingaddress" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="treatingdoctor_0_doctorname" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " <Field name="treatingdoctor_0_npi" size="2048" source="File: select * &#xA;from &quot;MEDSOL_01&quot;.&quot;PUBLIC&quot;.&quot;CASES_GB&quot;" type="V_WString" />" & @CRLF & _ " </RecordInfo>" & @CRLF & _ " </MetaInfo>" & @CRLF & _ " </Properties>" & @CRLF & _ " <EngineSettings EngineDll="AlteryxBasePluginsEngine.dll" EngineDllEntryPoint="AlteryxDbFileInput" />" & @CRLF & _ " </Node>" & @CRLF & _ " <Node ToolID="2">" & @CRLF & _ " <GuiSettings Plugin="AlteryxBasePluginsGui.BrowseV2.BrowseV2">" & @CRLF & _ " <Position x="366" y="222" />" & @CRLF & _ " </GuiSettings>" & @CRLF & _ " <Properties>" & @CRLF & _ " <Configuration />" & @CRLF & _ " <Annotation DisplayMode="0">" & @CRLF & _ " <Name />" & @CRLF & _ " <DefaultAnnotationText />" & @CRLF & _ " <Left value="False" />" & @CRLF & _ " </Annotation>" & @CRLF & _ " </Properties>" & @CRLF & _ " <EngineSettings EngineDll="AlteryxBasePluginsEngine.dll" EngineDllEntryPoint="AlteryxBrowseV2" />" & @CRLF & _ " </Node>" & @CRLF & _ " </Nodes>" & @CRLF & _ " <Connections>" & @CRLF & _ " <Connection>" & @CRLF & _ " <Origin ToolID="1" Connection="Output" />" & @CRLF & _ " <Destination ToolID="2" Connection="Input" />" & @CRLF & _ " </Connection>" & @CRLF & _ " </Connections>" & @CRLF & _ " <Properties>" & @CRLF & _ " <Memory default="True" />" & @CRLF & _ " <GlobalRecordLimit value="0" />" & @CRLF & _ " <TempFiles default="True" />" & @CRLF & _ " <Annotation on="True" includeToolName="False" />" & @CRLF & _ " <ConvErrorLimit value="10" />" & @CRLF & _ " <ConvErrorLimit_Stop value="False" />" & @CRLF & _ " <CancelOnError value="False" />" & @CRLF & _ " <DisableBrowse value="False" />" & @CRLF & _ " <EnablePerformanceProfiling value="False" />" & @CRLF & _ " <RunWithE2 value="True" />" & @CRLF & _ " <SortedGrouping value="True" />" & @CRLF & _ " <PredictiveToolsCodePage value="1252" />" & @CRLF & _ " <DisableAllOutput value="False" />" & @CRLF & _ " <ShowAllMacroMessages value="False" />" & @CRLF & _ " <ShowConnectionStatusIsOn value="True" />" & @CRLF & _ " <ShowConnectionStatusOnlyWhenRunning value="False" />" & @CRLF & _ " <ZoomLevel value="0" />" & @CRLF & _ " <LayoutType>Horizontal</LayoutType>" & @CRLF & _ " <MetaInfo>" & @CRLF & _ " <NameIsFileName value="True" />" & @CRLF & _ " <Name>Test</Name>" & @CRLF & _ " <Description />" & @CRLF & _ " <RootToolName />" & @CRLF & _ " <ToolVersion />" & @CRLF & _ " <ToolInDb value="False" />" & @CRLF & _ " <CategoryName />" & @CRLF & _ " <SearchTags />" & @CRLF & _ " <Author />" & @CRLF & _ " <Company />" & @CRLF & _ " <Copyright />" & @CRLF & _ " <DescriptionLink actual="" displayed="" />" & @CRLF & _ " <Example>" & @CRLF & _ " <Description />" & @CRLF & _ " <File />" & @CRLF & _ " </Example>" & @CRLF & _ " <WorkflowId value="6d029b0d-30da-40ad-819f-0d8b2dd496cb" />" & @CRLF & _ " <Telemetry>" & @CRLF & _ " <PreviousWorkflowId value="2fab71ce-8734-4c9a-9f05-e9279b77b7a8" />" & @CRLF & _ " <OriginWorkflowId value="2fab71ce-8734-4c9a-9f05-e9279b77b7a8" />" & @CRLF & _ " </Telemetry>" & @CRLF & _ " <PlatformWorkflowId value="" />" & @CRLF & _ " </MetaInfo>" & @CRLF & _ " <Events>" & @CRLF & _ " <Enabled value="True" />" & @CRLF & _ " </Events>" & @CRLF & _ " </Properties>" & @CRLF & _ "</AlteryxDocument>" 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