[CCP14 Home: (Frames | No Frames)]
CCP14 Mirrors: [UK] | [CA] | [US] | [AU]

(This Webpage Page in No Frames Mode)

Collaborative Computational Project Number 14

for Single Crystal and Powder Diffraction

CCP14

Using Bill Klein's BK ReplaceEM for Windows for mass website HTML text changes

The CCP14 Homepage is at http://www.ccp14.ac.uk

[Back to CCP14 Web/Config Main Page]

[The Problem] | [The Solution] | [Adding New Webmirror Links]

The Problem

If you have to perform mass changes large website containing static HTML pages, this can be painfull to do manually. Thus a more powerful automated way of doing this is preferable and can turn a few days, weeks or months of work into a 5 minute job.


The Solution

Of all the available programs that were checked, the freeware BK ReplaceEm for Windows was the best, the most reliable, the most flexible and easiest to use.

Doing a change like the following in every webpage is trivial and can be done with very little effort (first right-click on a row of search/replace text and choose Advanced Edit, then cut and paste in the text):

E.g., From:

<FONT SIZE=2>
  [<A HREF="http://www.ccp14.ac.uk/" target="_top">UK</A>] | 
  [<A HREF="http://ccp14.sims.nrc.ca" target="_top">CA</A>] | 
  [<A HREF="http://ccp14.semo.edu" target="_top">US</A>] | 
</font>

To:

<FONT SIZE=2>
  [<A HREF="http://www.ccp14.ac.uk/" target="_top">UK</A>] | 
  [<A HREF="http://ccp14.sims.nrc.ca" target="_top">CA</A>] | 
  [<A HREF="http://ccp14.semo.edu" target="_top">US</A>]
  [<A HREF="http://ccp14.minerals.csiro.au" target="_top">AU</A>]
</font>


Adding New Webmirror Links using BK ReplaceEm

However, what is not so trivial is the adding of new Mirror pointers to individual programs and mirrored websites such as the following (used profusely in pages such as the Download Programs webpage).

E.g., Replace:

">Canadian CCP14 Mirror</a>] | 
[<a href="http://ccp14.semo.edu/%%VARYING_TEXT%%">US CCP14 Mirror</a>]
</font>
To:
">Canadian CCP14 Mirror</a>] | 
[<a href="http://ccp14.semo.edu/%%VARYING_TEXT%%">US CCP14 Mirror</a>] | 
[<a href="http://ccp14.minerals.csiro.au/%%VARYING_TEXT%%">Australian CCP14 Mirror</a>]
</font>

However, using BK ReplaceEm's Regular Expression system, this can be done in a few minutes. (The following was with assistance from Bill Klein).

In BK ReplaceEm, first right-click on a row of search/replace text and choose Advanced Edit. Then choose Regular Expression from the drop-down list at the bottom-left.

For the search text (in this example, adding the Australian mirror), type:

">Canadian CCP14 Mirror</a>\] \| 
\[<a href="http://ccp14.semo.edu/([^"]*)">US CCP14 Mirror</a>\]
</font>

(though you may have to add multiple versions if you were careless with setting up the original HTML and there are very minor varients)

">Canadian CCP14 Mirror</a>\] \|
\[<a href="http://ccp14.semo.edu/([^"]*)">US CCP14 Mirror</a>\]
</font>

(From Bill: Notice the use of escaping square brackets and pipes with the backslash since they are special regular expression characters).

For the replace text, type:

">Canadian CCP14 Mirror</a>] | 
[<a href="http://ccp14.semo.edu/\1">US CCP14 Mirror</a>] |
[<a href="http://ccp14.minerals.csiro.au/\1">Australian CCP14 Mirror</a>]
</font>


A screen image of adding the regular expression into BK ReplaceEm follows:

adding the regular expression into BK ReplaceEm


[CCP14 Home: (Frames | No Frames)]
CCP14 Mirrors: [UK] | [CA] | [US] | [AU]

(This Webpage Page in No Frames Mode)

If you have any queries or comments, please feel free to contact the CCP14