A PowerReplace Expression (PRExpression) is a text line containing two strings: first-string and second-string,
enclosed by quotation marks and separated by space or tabulation. It means that the first-string will be replaced by the second-string everywhere in a text file. For example, the PRExpression
"print" "write"
means replace the word "print" by "write".
The first-string, if necessary, may contain one special character * in the middle for any indeterminate string. The following PRExpression
"%*\n" ""
means delete all characters of a line beginning with % (delete Tex comment).
A Filter File is a text file containing many PRExpressions after being made through the menu “PowerReplace/File/Make Filter File”.
See also the documentation “FAQ” to understand better how to write PRExpression.
Create New Filter File:
(1) Create a text file using any text editor. Put your own PRExpressions in this file.
(2) Select the menu “File/Make Filter File”. The “Make PowerReplace Filter File” window appears.
(3) Click the button “Choose File”, and select the file that you have created at (1). The name of the text file will appear.
(4) Set option boxes in this window.
- If the “Extension Name” is empty, you must set the “Delete original file” option on.
- If the first-string in all PRExpressions is only one character, you can set the “Char Convert Only” option on. It will accelerate converting speed.
- Use Balloons Help system for more information.
(5) Click the button “Make” to turn this file into filter file. A progress indicator window appears during a short moment.
- If you want to create other filter file, repeat (1)-(5).
(6) Put the new created filter file into the “Filter” folder.
(7) Restart the application. This filter file will appear in the menu “Filter” and you can select it for your conversion.
See also the documentation “for beginners” to learn step by step from a complete example.
Syntax Summary:
Filter File:
Filter File-Text after being made through the menu “PowerReplace/File/Make Filter File”
Filter File-Text:
line... (... means repeat many time)
line:
PRExpression or
comment
comment:
%string-without-cr\r
PRExpression:
"first-string" "second-string"\r
first-string:
string or
string*string
second-string:
string
string:
char...
char:
normal-char or
special-char
char-without-cr:
normal-char or
special-char (excepte \r)
string-without-cr:
char-without-cr...
normal-char:
printable character (except the three following " \ *)
special-char:
\\ representing \ or
\" representing " or
\* representing * or
\t representing TAB or
\n representing LF or
\r representing CR
Filter File Examples with this distribution:
DelCComment:
Remove comment in C++ source file. There is two styles: /* */ and //
DelResource:
Remove resource fork of file.
Filter->Readme:
Create readme for PowerReplace's filter file.
min -> MAJ:
Change lower character to upper character. For french text file, the lower character with accent is changed to corresponding upper character without accent.
MMat->TeX:
Change Mathematica Matrix format to Tex format.
PCTeX8->MacTeX8:
This filter file converts IMB PC TeX 8 bits text format to Mac 8 bits format.
TeX->Html:
Convert Tex 7 bits file to HTML format.
TeX->Text:
Remove mathematical formule, comment and command in Tex source file.