I am working on optimizing some of my web pages for SEO. I need to add in my keywords to the urls within my html files.
I need to change this...
<a href="http://www.mysite.com/States/Cities/Gre ... htm">Green Valley Lake</a>
<a href="http://www.mysite.com/States/Cities/Lyoth.htm">Lyoth</a>
<a href="http://www.mysite.com/States/Cities/Ing ... glewood</a>
<a href="http://www.mysite.com/States/Cities/Pin ... .htm">Pine Grove</a>
<a href="http://www.mysite.com/States/Cities/Cer ... erritos</a>
<a href="http://www.mysite.com/States/Cities/Val ... Vallejo</a>
<a href="http://www.mysite.com/States/Cities/Mou ... htm">Mount Laguna</a>
<a href="http://www.mysite.com/States/Cities/Campo.htm">Campo</a>
<a href="http://www.mysite.com/States/Cities/For ... Fortuna</a>
to this...
<a href="http://www.mysite.com/States/Cities/CA- ... htm">Green Valley Lake</a>
<a href="http://www.mysite.com/States/Cities/CA- ... ">Lyoth</a>
<a href="http://www.mysite.com/States/Cities/CA- ... glewood</a>
<a href="http://www.mysite.com/States/Cities/CA- ... .htm">Pine Grove</a>
<a href="http://www.mysite.com/States/Cities/CA- ... erritos</a>
<a href="http://www.mysite.com/States/Cities/CA- ... Vallejo</a>
<a href="http://www.mysite.com/States/Cities/CA- ... htm">Mount Laguna</a>
<a href="http://www.mysite.com/States/Cities/CA- ... ">Campo</a>
<a href="http://www.mysite.com/States/Cities/CA- ... Fortuna</a>
and this is what I tried with no luck...
"text to find"
<a href="http://www.mysite.com/States/Cities/(.+).htm">Green Valley Lake</a>
"replace with"
<a href="http://www.mysite.com/States/Cities/CA- ... htm">Green Valley Lake</a>
I have no idea if the syntax is right. I am assuming that "(.+)" will copy the "Green-Valley-Lake" string from my example above and then "($1)" will write the string, "Green-Valley-Lake," to my output file. Is this correct? I also do not know anything about the modifiers either. Everything I've learned has been from the examples in the forums. Thanks for any help you can give!
Wildcard syntax problem...
Re: Wildcard syntax problem...
Your expressions are almost correct, but:
1. In Search For part: . (dot) before htm is a reserved char. So you
should use \.htm
2. In Replace With part: you simply put $1 without ()
3. You don't need to add "Green Valley Lake</a>" part to the end of
the expressions.
Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
<a href="http://www.mysite.com/States/Cities/(.+)\.htm">
Replace with:
<a href="http://www.mysite.com/States/Cities/CA-$1-Widgets.htm">
That's all I verified it works perfectly.
1. In Search For part: . (dot) before htm is a reserved char. So you
should use \.htm
2. In Replace With part: you simply put $1 without ()
3. You don't need to add "Green Valley Lake</a>" part to the end of
the expressions.
Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
<a href="http://www.mysite.com/States/Cities/(.+)\.htm">
Replace with:
<a href="http://www.mysite.com/States/Cities/CA-$1-Widgets.htm">
That's all I verified it works perfectly.