Some weeks ago I suggested the need for a "wildcard dictionary" and asked readers to send in their contributions. You can read that article here:
http://www.topica.com/lists/editorium/read/message.html?mid=1711394495
I heard from Rosalie Wells, Hilary Powers, Eric Fletcher, Allene Goforth, Michael Coleman, and Steve Hudson, who sent some great wildcard strings and commentary on their use. Many thanks to them, and, if I missed anyone, many apologies.
You can learn more about finding and replacing with wildcards in these back issues of Editorium Update:
http://www.topica.com/lists/editorium/read/message.html?mid=1705963026
http://www.topica.com/lists/editorium/read/message.html?mid=1706069286
http://www.topica.com/lists/editorium/read/message.html?mid=1706167662
http://www.topica.com/lists/editorium/read/message.html?mid=1706267069
http://www.topica.com/lists/editorium/read/message.html?mid=1706365638
http://www.topica.com/lists/editorium/read/message.html?mid=1706458823
And now, the wildcard dictionary entries! (Before using any of these in the real world, be sure to try them on some test documents to make sure they will do what you need. You should do that with any wildcard string, of course.)
___________________________________
ROSALIE WELLS wrote:
I use this one all the time in my translations into Spanish to change the decimal separator "period" to a "comma" separator as required for many Spanish-speaking countries:
Find what: ([0-9]).([0-9])
Replace with: 1,2
___________________________________
HILARY POWERS wrote:
I tend to design strings from scratch when needed, but here are a couple that I use often enough to more or less remember them:
.([A-Z])|. 1
opens up initials on reference lists; requires fixing things like U.S. and N.Y. after
([0-9]). |^t1.^t
indents hand-typed list numbers
[!.]^013 - review one by one and add periods by hand where needed. There's a way of scanning for more end-sentence punctuation and doing the change automatically, but I'm usually too lazy to look it up and this is what I remember. A complete punctuation scan would be quite welcome. . . .
It'd be a good idea to emphasize that the Wildcard and Revision Tracking features do bad things to each other, at least in Word 97. Some simple replaces will work with tracking on, but it's hard to predict which ones are safe and which ones will scramble the new info. Before running any wildcard replace operation, it's best to save the file and then turn the tracking off. Run the replace, check to see if it worked, then TURN THE TRACKING BACK ON.
___________________________________
ERIC FLETCHER wrote:
I have my favourites in various Word files I seem to never get around to consolidating. But here are a few I found without having to look very hard:
DESCRIPTION: Finding a telephone number formatted as 123-4567.
FIND WHAT: ([0-9]{3})(-)([0-9]{4})
REPLACE WITH:
KEY WORDS: Telephone number
BEFORE:
AFTER:
COMMENTS: This is handy for doing a quick review of phone numbers. In Word 2002, you can choose to select all occurrences so you can see them easily in context.
DESCRIPTION: Changing telephone numbers formatted as (123) 456-7890 or (123)456-7890 to 123-456-7890.
FIND WHAT: ([(])([0-9]{3})([)])(*)([0-9]{3})(-)([0-9]{4})
REPLACE WITH: 2-567
KEY WORDS: Telephone number
BEFORE: Telephone numbers formatted as (123) 456-7890 or (123)456-7890.
AFTER: Telephone numbers formatted as 123-456-7890 or 123-456-7890.
COMMENTS: Note that the (*) looks after catching situations where there may or may not be a space after the area code portion.
DESCRIPTION: Find formatted text and change it to use HTML codes.
FIND WHAT: Font=Italic
REPLACE WITH: ^&
KEY WORDS: Italic, HTML, formatting
BEFORE: Change the italicized words to use HTML codes.
AFTER: Change the italicized words to use HTML codes.
COMMENTS: If you include Font=Not italic in the Replace with, the italics will be removed as well. Use variations of this for any formatting and other HTML codes.
DESCRIPTION: Find text coded with HTML and change it to Word formatting.
FIND WHAT: ()(*)()
REPLACE WITH: 2 Font=Italic
KEY WORDS: HTML, italic, formatting
BEFORE: Change the italicized words to regular Word formatting.
AFTER: Change the italicized words to regular Word formatting.
COMMENTS: Use variations of this for any formatting and other HTML codes.
___________________________________
ALLENE GOFORTH wrote:
Here are five of my wildcard routines. I use more than those, but some are specific to various publishers, and others are of the half-baked variety.
DESCRIPTION: In APA-style references lists, find volume numbers in roman and change them to italic. Retain the issue numbers in roman.
FIND WHAT: , [0-9]{1,}
REPLACE WITH: [nothing]; change font to italic
KEY WORDS: APA, references, volume numbers
BEFORE: Developmental Neurobiology, 13(2)
AFTER: Developmental Neurobiology, 13(2)
COMMENT: Find string includes a space between the first comma and the bracket.
DESCRIPTION: In APA-style references lists, find issue numbers in italics and change to roman.
FIND WHAT: ([0-9]@)
REPLACE WITH: [nothing]; change format to roman
KEY WORDS: APA, references, issue numbers
BEFORE: Developmental Neurobiology, 13(2)
AFTER: Developmental Neurobiology, 13(2)
DESCRIPTION: In APA-style references lists, find initials in names that need a space inserted after the period.
FIND WHAT: ([A-Z].[!A-Z])
REPLACE WITH: 1
KEYWORDS: APA, references, initials
BEFORE: Brown, A.C.
AFTER: Brown, A. C.
COMMENTS: A space is needed at the beginning of the Replace string.
DESCRIPTION: In APA-style references lists, find name strings containing "&" that need commas inserted before the "&."
FIND WHAT: ( [&])
REPLACE WITH: ,1
KEY WORDS: APA, references, &, comma
BEFORE: Smith, A. B. & Gordon, D. J.
AFTER: Smith, A. B., & Gordon, D. J.
COMMENTS: In the Find string, there is a space between the opening parenthesis and the bracket.
DESCRIPTION: Find and close up space between journal volume number and issue number in APA-style references lists.
FIND WHAT: (([0-9]@))
REPLACE WITH: 1
KEY WORDS: APA, references, space, volume, issue
BEFORE: 45 (3)
AFTER: 45(3)
COMMENTS: In the Find string there should be a space before the opening parenthesis. There should not be a space before the first character in the Replace string.
___________________________________
MICHAEL COLEMAN wrote:
Right now I'm working on an index. There's not a lot of work to be done, but it was exported from Quark to Word, so all the formatting was stripped. (If there's a way to avoid that, I'd love to learn about it.) So I set styles for the four levels. Simple enough. The only other trick is to get back all of the italics. There are a few titles that need to be italicized, and fortunately I know that they all have names with at least three words, so I searched for a string
[A-Z]([a-z]@) [A-Z]([a-z]@) [A-Z]
I didn't make any automatic changes because several titles fit the string but don't get italicized.
We used to have a lot of tables, figures, and exhibits in our books, but now they're all called figures. In the index, the appropriate first letter--t, f, or e--appeared in italics after the page number, such as 11-11e. (We use chapter-page pagination.) So I searched for
([0-9])[e,f,t]
I set the replace string to italic and replaced with
1f
Then I searched for ([0-9]) formatted as italic and changed it back to roman using 1.
Our old style was to use en dashes to show a range of pages, but that was hard to read because of the hyphens in the chapter-page pagination format. So we changed it to "to." I therefore searched for
^=([0-9])
And replaced it with
to 1
___________________________________
STEVE HUDSON wrote:
Remove Time stamping from most logs:
F: [[]*[]]
R: nothing
Kill excessive blank paras
F: ^p^p^p
R: ^p^p
Locate some passive voice instances
Find: be <*ed>
Convert a list of Firstname Lastname to Initial. Lastname
Find <(?)(*)> <(*)>
Replace 1. 3
Find manually formatted numbering (hand tweak)
F: [0-9]@.^t
R: Pass 1 List style, pass 2, nil.
Straight Quotes to Curly Quotes
To turn curlies to straight:
1. Turn off the Autocorrect
2. Go to your find and replace dialog and replace " with ".
Sharon Key wrote asking why, after selecting smart quotes, her find and replace of quotes with themselves didn't work to trigger the replacement from straight to curly. Yes, your FnR (find and replace) is NOT triggering the smart quote function. To do that it needs something before or after the quote to help the smart quote system dope it out. It's actually triggered by an "end of word" condition. So to replace straight quotes with curly quotes, use these FnR's with Wildcards enabled (select More and then look at options near the lower left)
Find: "(<*>)
Replace: "1
Find: ([! ])"
Replace: 1"
Both formulae use the () to force capture of that segment to be referred to in the replace section as 1 (or whatever left -> right position it holds if there are multiple bracketed entries).
The first finds quotes followed by a word ( a < is a start of a word, * is anything, a > is the end of a word), and replaces the quote with the word (now referred to as 1 from being bracketed) after it. You can't use that same trick for the second, as it selects the whole string of words afore it, and the smart quote feature is confused as the last typed character was in a range. So, we find any non blank character followed by a quote, and replace the single character and the quote. This will take care of most of your problems.
FnR CheatSheet
?= Any 1 character
*=Any string of characters
@ any number of repeats of the previous character
<=the beginning of a word
=the end of a word
{n}=n repeats of the previous char
{n,}=at least n repeats
{n-m}= between n and m repeats
[ ] marks a set of characters. A - used inside this means an ascending range between the two hyphenated characters. A !, only valid at the set's start, means 'any character except'.
() groups the expressions and indicates the order of evaluation. It is used with the n wildcard to rearrange expressions. The result of the 1st () pair is represented by 1, the next pair 2 and so on.
The easiest way is to use a special character as a literal, e.g. to find a bracket character, use ASCII code 40 instead. ASCII codes are specified in ANY sort of search with the caret ^.
= ^92
(=^40
)=^41
?=^63
{=^123
}=^125
[=^91
]=^93
@=^64
<=^60
=^62
*=^42
^=^94
To find some relevant information in Word's help file, Contents > Editing and Sorting text > Finding and Replacing Text. A few links later you can get some wildcard information.
10{1,3} finds "10", "100", and "1000".
[10]@ finds any binary number
<[a-zA-Z]{1,3}> finds words of three letters or less.
<[A-Z][a-z]@> finds any title-cased word.
<[0-9]@> finds any whole number, <[0-9]{1,3}> from 0-999
Find: <([0-9]@[/.-])([0-9]@[/.-])([0-9]@>)
Replace with: 2 1 3
Changes all numeric dates from DD/MM/YY(YY) to MM/DD/YY(YY) and back again.
_________________________________________
READERS WRITE
Readers have sent so many great tips and comments that it's taking a while to go through them all. They'll be appearing in the newsletter over the next few weeks. Thanks for your patience.
_________________________________________
RESOURCES
There's an excellent explanation of how to find and replace with wildcards at the Microsoft Word MVP site:
http://www.mvps.org/word/FAQs/General/UsingWildcards.htm