WildCardReplace

2000.05.06 

 

http://www.barefeetware.com/appleworks/wildcardreplace/

Description

 

This “WildCardReplace” AppleWorks script creates a simple facility for doing Searches & Replaces based on Wild Cards.

Scripts

 

See the scripts page for general installation and usage information.

by Neil Taylor

 

This script was not developed by BareFeetWare. Contact the author directly with any questions and feedback.

Download

 

Download the script from here.

     


Detail
WildCardReplace works like a normal find and replace combination except that it allows you to use wild cards to represent characters that may be variable.

Every word of the selected text is compared against the input mask and the output mask is used to change related portions of the word.

Input mask – Letter, number or most special characters. Requires a match with the word in the selected position.

Note: If the mask letter is Upper Case it must be an exact match. If the mask letter is lower case then either upper or lower case letters will be matched.

• (option 8) – Represents any number of intervening characters within the word.
÷ (option /) – Represents any single character.

Output Mask – Letter, number or most special characters. Replaces the portion of the word that matches the input with that character.

• (option 8) – Copies the portion of the word represented by the matching • from the input mask.
(option =) – Copies the corresponding character from the input word. (often, but not necessarily the one(s) matched using ÷


Sample
Given some selected text containing the following “words”: “Abc abc Abcd Abcdef Accdef adcdef aecdef.”

You would get the following results:

Find Mask Replace mask Finds these words Replaces them with
A÷C XY nothing n/a (there’s no upper case C as the 3rd letter)
A÷c XY Abc XbY
a÷c y Abc abc Aby aby
Abc• Xyzyx• Abc Abcd Abcdef Xyzyx Xyzyxd Xyzyxdef
A÷c•f •fgh Abcdef Accdef Abdefgh Acdefgh
Abc• XbcX• Abc Abcd Abcdef XbbcX XbbcXd XbbcXdef
Abc• XAbX• Abc Abcd Abcdef #error! (no corresponding input character to match the ).


Limitations
The script only deals with single words for the time being. I am working on an upgrade to allow multiple words. Any other suggestions might also be considered.

Requires Jon’s Commands scripting additions (or a later version of AppleScript that includes clipboard control). Available from his Web Site. I could have done it without, but it would have been MUCH slower and uglier.

Requirements
This script works with AppleWorks 5. It has not been tested with AppleWorks 6.


© 2000 BareFeetWare