Advanced Replacement Examples

What Is It?

This is a demonstration package that contains some examples of the advanced replacement capabilities of Find & Replace It! , especially when it comes to dynamic text replacement.

One of the most powerfull feature of Find & Replace It! is its ability to dynamically transform the texts to be replaced. This involves mixing all the classical possibilities of regular expressions with JavaScript programming. Even though it is possible to look for very complex patterns with regular expressions, a simple replacement by a static text is often insufficient. The scripting feature gives us all the power of JavaScript to format whatever we need while the regular expression simply tells us where to apply the script.

In order to make your life easier, this package provides you with some examples to get started with the scripting interface. The examples included in this package demonstrate how to:

  • convert numerical values from millimeters to inches within a csv file;
  • rename any getter method in your source code, by reusing the initial name of the method;
  • insert a dynamic header containing the current date and the name of the file in your source code files;
  • play with the level of all titles contained in a HTML document;
  • use script to interpret sequences of ASCII characters in your replacement texts;
  • manipulate headers and footer of documents by updating the copyright year, changing page numbering, removing the footer, etc;
  • automatically update a continous numbering for specific elements in a document (using the index of the current occurrence);
  • synchronize a subtitle file (.srt) with a movie by applying a constant time shift, or a constant time shift plus a linear speed correction;
  • replace ZIP codes by using a dictionary that defines the mapping between the old ZIP codes and the new ones;
  • etc.

How to Use It?

To use the FRI files contained in the package, simply run Find & Replace It!, click on the File/Open... menu command, then select the file of your choice. You must turn on the visibility of the Find & Replace Editor to view what has been loaded from the file.

Each FRI file comes up with its related .preview.xxx file. In order to visualize what's going on with the given replacement configuration, you should activate the display of the Find & Replace Preview then load the appropriate .preview.xxx file in it. To do so, simply click on the Open file in preview button which is located under the preview area. After that you'll be able to play with the Display mode dropdown list.

Alternatively, you can use the files suffixed by .full.fri. These files contain everything including the preview content.