Hi,
Thank you for your help on my last question. I was doing fine until this.
I want to capture the author name from the <p>by: fname lname</p> line and place into the Author meta tag.
My existing html document: (the jave code is one line and no special characters).
<meta name="Author" content="someone @ the-internet.com" />
<meta name="Robots" content="noindex,nofollow" />
<link rel="stylesheet" href="../stylesheet.css" type="text/css" />
</head>
<script language="JavaScript1.2">
function run()
{
some java code here
}
</script>
<body>
<!-- Article Start -->
<h1>10 Article Writing Quirks</h1>
<!-- Author -->
<p>by: Nicholas Dixon</p>
<p>Much has been touted about... rest of the file
This is the RE I tried:
search for: <meta name="Author" content="(.*)" />\r\n(.*)<!-- Author -->\r\n<p>by: (.*)</p>\r\n
replace with: <meta name="Author" content="$3" />\r\n$2<!-- Author -->\r\n<p>by: $3</p>\r\n
The result is:
<meta name="Author" content="Nicholas Dixon</p>
<p>Much has been touted about... rest of the file
I tried modifiers S,G and S,G,M.
You know, I turned off the S and M modifier and it worked! So no need to reply - thanks
Thanks in advance.
Using mulitple wildcard for replace
Using mulitple wildcard for replace
Thanks,
Tim
Tim
Re: Using mulitple wildcard for replace
predaina wrote:This is the RE I tried:
search for: <meta name="Author" content="(.*)" />\r\n(.*)<!-- Author -->\r\n<p>by: (.*)</p>\r\n
replace with: <meta name="Author" content="$3" />\r\n$2<!-- Author -->\r\n<p>by: $3</p>\r\n
The result is:
<meta name="Author" content="Nicholas Dixon</p>
<p>Much has been touted about... rest of the file
I have verified your RE: it's correct and it's working.
The only question is to setup correct modifiers:
State of Modifier M: does not matter for your case. The same for
modifiers: I, X and E.
But you have to turn on Modifier S. So .* in \r\n(.*)<!-- Author -->
will be used across several lines of text.
And you have to turn off Modifier G. That's why you have got the
result (text in red above). Because it was taken in greedy mode.
It can be even more powerful with Modifier E turned on.
You may convert text into upper or lower case, wrap text, compare text
and execute some other useful functions.
You may convert text into upper or lower case, wrap text, compare text
and execute some other useful functions.