EDIT: I am using PCRE RegEx language for now.
I have a scenario where I have VBScript string values at the top of every webpage on my site. (This site is in the middle of a redesign.) I need to use these assignments in a search and replace scenario, using RegEx, and replace another part of HTML element to give it that string value.
This below successfully extracts "Member Access" from the variable at top of page and I can use $1 to place that variable somewhere. But this is where I get stuck. I need to stick that value somewhere else, such as in the tag. What do I type in the replace field to keep everything, but only replace certain items, such as the text in between the title tag for example?
I basically need to find two things. Find the first, then use replacement on the second find:
<title>this text</title>
RegEx filter: /PageTitle = "(.*)"/ gm
Replacement string: <everything before Page Title string>PageTitle = "$1"<everything after PageTitle string><title>$1</title><Rest of content after title tag>
Here's example of what each page on my site looks like:
<%
Page Title = "Member Access"
MetaDescription = "This is a paragraph describing our website that we use to place into the meta description tag in the head. This will give information about our site."
Keywords = "Awesome, Cool, Rad, Tubular"
%>
<!doctype HTML>
<html dir="ltr" lang="en">
<head>
<meta charset="UTF-8">
<!-- Meta Tags -->
<meta name="description" content="This needs to be replaced with MetaDescription variable at top of page">
<meta name="keywords" content= "these, need, to, be, gone">
<meta name="viewport" content="width=device-width, initial-scale=1.0 shrink-to-fit=no">
<!-- Twitter and Facebook Social media tags -->
<meta property="fb:app_id" content="" />
<meta property="og:title" content="This needs to be replace with Page Title variable at top of page" >
<meta property="og:description" content="This needs to be replaced with MetaDescription variable at top of page">
<!-- Page Title -->
<title>This needs to be replaced with Page Title variable at top of page</title>
</head>
<body>
<div id="main" class="main-content">
<section class="inner-header divider layer-overlay overlay-dark-4" data-bg-img="/images/_interior-banners/THIS NEEDS TO BE REPLACED CONDITIONALLY BASED ON SITE FOLDER" style="background-image: url('/images/_interior-banners/THIS NEEDS TO BE REPLACED CONDITIONALLY BASED ON SITE FOLDER'); ">
<h1 id="page-title" class="font-36">This needs to be replaced by Page Title variable at top of page</h1>
rest of webpage content......
</div>
</section>
</body>
</html>
)([^<]*)(
)` where the title match group is $2 with replacement $1$3$4$2$6$7$8$2$10 - that doesnt work exactly, though so maybe you or someone can fix it? – James S May 18 '20 at 14:50Member Access
````` Where "Member Access" is what was found from searching for what the Page Title variable contained. The variable will be different on every page. – codewelldesign May 18 '20 at 15:49