$re = '/^(PageTitle = "([^"]*)")(.*)(<title>)([^<]*)(<\/title>)(.*)(<h1 id="page-title" class="font-36">)([^<]*)(<\/h1>)(.*)$/ms';
$str = '<!-- and this include too -->
Must include all this too
<%
PageTitle = "Member Access"
MetaDescription = "There are a number of degree and education paths that can lead an individual to a career in toxicology. This page is designed to provide those considering a career in toxicology with information on the profession, schooling needed, and more. The content of this page was originally developed as a printed publication called Resource Guide to Careers in Toxicology"
Keywords = "SOT, Toxicology, Careers, Resource Guide"
SocialImage = "http://209.183.221.233/images/sot_logo.png"
SocialImageDescription = "SOT logo"
SocialURL = "http://209.183.221.233/login.asp"
%>
<!doctype html>
<html dir="ltr" lang="en">
<head>
<meta charset="UTF-8">
<!-- Meta Tags -->
<meta name="description" content="There are a number of degree and education paths that can lead an individual to a career in toxicology. This page is designed to provide those considering a career in toxicology with information on the profession, schooling needed, and more. The content of this page was originally developed as a printed publication called Resource Guide to Careers in Toxicology">
<meta name="keywords" content= "SOT, Toxicology, Careers, Resource Guide">
<meta name="viewport" content="width=device-width, initial-scale=1.0 shrink-to-fit=no">
<meta name="author" content="Society of Toxicology" />
<meta name ="robots" content="index" >
<!-- Twitter and Facebook Social media tags -->
<meta property="fb:app_id" content="309282950004135" />
<meta property="og:title" content="New Experiences in Toxicology Program" >
<meta property="og:description" content="There are a number of degree and education paths that can lead an individual to a career in toxicology. This page is designed to provide those considering a career in toxicology with information on the profession, schooling needed, and more. The content of this page was originally developed as a printed publication called Resource Guide to Careers in Toxicology">
<meta property="og:image" content="http://209.183.221.233/images/sot_logo.png">
<meta property="og:url" content="http://209.183.221.233/education/st/next.asp">
<meta property="og:type" content="website" />
<!-- Non-Essential, But Recommended -->
<meta property="og:site_name" content="Society of Toxicology">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image:alt" content= "SOT logo">
<meta name="twitter:creator" content="@SOToxicology" />
<!-- Non-Essential, But Required for Analytics -->
<meta name="twitter:site" content="@SOToxicology">
<!-- Follow Facebook\'s recommendation of a minimum dimension of 1200x630 pixels and an aspect ratio of 1.91:1, but adhere to Twitter\'s file size requirement of less than 1MB.-->
<!-- Page Title -->
<title>New Experiences in Toxicology Program</title>
<!-- #include virtual="/_includes/header_newsite_trt.asp" -->
<div id="main" class="main-content">
<section class="inner-header divider layer-overlay overlay-dark-4" data-bg-img="/images/_interior-banners/About-banner.jpg" style="background-image: url(\'/images/_interior-banners/About-banner.jpg\'); ">
<div class="container pt-30 pb-30">
<!-- Section Content -->
<div class="section-content">
<div class="row">
<div class="col-md-6">
<h1 id="page-title" class="font-36">New Experiences in Toxicology Program</h1>
<ol class="breadcrumb text-left mt-10 white">
<li class="active">New Experiences in Toxicology Program</li>
</ol>
</div>
</div>
</div>
</div>
</section>
<!-- #include virtual="/_includes/social-buttons.asp" -->
<!-- Indvidual Page Content Below -->
<!-- #include virtual="/_global/SOTLogin.asp" -->
<!-- Section: Paragraph --->
<section>
<div class="container ">
<div class="section-content">
<CENTER>
<TABLE width=500>
<TR>
<TD height="0" width="226"></TD>
<TD width="108"></TD>
</TR>
<TR>
<TD height="211" valign="top">
<TABLE >
<TR>
<TD align=center height="185">
<noscript>
Javascript not enabled. <BR>Membership functions are not available.
</noscript>
<% If Request.Cookies("sot-session-id") <> "" Then %>
<h3>You are now logged in.<br>Please wait for the page to be redirected.</h3>
<meta http-equiv=\'refresh\' content=\'1;url=/\'>
<% End If %>
</font></TD>
</TR>
</TABLE>
</TD>
<TD height="211"></TD>
</TR>
</TABLE>
</CENTER>
</div>
<!-- /columns -->
</div>
</section>
<!-- /section Full paragraph ends-->
<!-- #include virtual="/_includes/footer.asp" --> ';
$subst = "$1$3$4$2$6$7$8$2$10$11";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$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 PHP, please visit: http://php.net/manual/en/ref.pcre.php