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