Solving Hard Problems: Software, Part I

Advanced search and replace techniques for MS-Word

If you needed to to reformat your text to find every title that was in all caps, longer than three characters and add an additional line (carriage return), how would you do it?

Having spent the better part of the year on technology and cultural commentary, we’re going to wrap up with a series of specific posts on how to solve specialized challenges with software. The compound types of issues that happen in the real world, those hard enough to be worth solving. Pay it forward and share your skills with someone this week, before the turkey tryptophan sleepiness sets in for all of us in the national state of Texas and all ya’ll in the rest of the world that celebrate a national Thanksgiving Day (whenever it may be for you).

A case of Necessity is the mother of invention

Hope that these will prove as valuable for your office/organization as they have for ours. It’s always interesting when people ask software help questions only to find out that the “expert” knows less than the one questioning.

When one advances to the state of humble maturity characterized in these pages as yarak, a Persian falconry word for “hunger that heightens the senses,” that rarely happens. Real subject matter experts understand that the more they learn, the more they realize they don’t know.

First, a screed

Professional printers, people that actually put ink on paper (or other materials), almost universally refuse to work on Microsoft Office Word files. Not because they believe the boys & girls in Redmond are a scourge on the face of the earth (oops, was that my outside voice?…), but for the very pragmatic reason that time is money. Every business is in business to make a profit delivering excellence in their chosen field of endeavor. If the raw material takes extensive rework, then their costs will be out of line with their competitors and they will go out of business, barring the nonsense of government bail-outs.

O’Reilly Media has excellent background information on this for those interested. For the nit-pickers out there, O’Reilly is a publisher. Professional printers like Vicks Litho, are the gifted souls who actually give you the document you can hold in your hands, scribble notes in the margin, apply Post-It® notes to and generally give way more love than a digital copy. Dwight and his team come with my highest recommendation.

As a work-around if your budget or an inane corporate policy precludes choosing a better tool (like XML Mind), the Adobe Professional suites have “preflight” functions that correct virtually all of the corrupted MS-Word code that would fail at the printer, so you can deliver print-ready files with the combination of Word + Adobe’s preflight functionality.

On to our story

Let’s say you’ve been progressing on a training exercise with role-play, where there are speaking parts for various people.

The Goal

If you needed to to reformat your text to find every role title and add an additional line (carriage return), how would you do it?

Manually hitting the keyboard is out of the question for a compound document spanning hundreds of pages. The solution is a very mixed bag, yet after you climb the mountain, you do get the job done.

The way to go about this is through the Search & Replace with wildcards. Translating our objective into a “search” string and a “replace” string means diving deep into the belly of the beast, learning some very arcane commands which no self-respecting person would admit to knowing, so rest assured, mum’s the word. Your secret is safe with me, dear reader.

Now the adventure begins.

What we’re creating are two “search strings” that we’ll be typing into the search and replace boxes, respectively. We’re going to find the role name that begins with any letter from A to Z, is longer than three characters and ends with a paragraph mark.

1) To find the beginning of a word use the “less than” caret < and to the find the end, use the “more than” caret >.

<our stuff here>

2) All the role names should be capitalized, but to also find those that are not, we use the square brackets wildcard [] to search for all letters A-Z.

[A-Z]

3) The search length uses the the squiggly parentheses-type marks called “braces” {}, with the number of characters (letters, numbers, punctuation, anything) inside. Yes, the comma is required.

{3,}

4) To find a paragraph mark, type ^13, because naturally enough, the code that is near-industry standard doesn’t work when “use wildcards” is on.

To search use ^13

(As an aside, the technical term for the paragraph character, ¶ is “Pilcrow” which will help if you need to look it up in an online tool such as the massively useful FileFormat Unicode web database.

Now replace what you’ve found

We’re going to add a line (or carriage return for people who remember manual typewriters and hot lead typesetting machines) before the role name, so we’ll use the same code for paragraph as before with a wee bit of magic that says, “everything that was in the ‘Find what’ box put right here.” That magic would be the ampersand

^&

(All you instructional design folks who are going apoplectic because I’ve switched the formatting premise, take a chill pill will ya?)

So a screenshot of the final result is what the whole enchilada looks like:

We’ll address the usefulness of highlighting in another blog.

Until next time,

Carpe Diem!

Matt

1 comment to Solving Hard Problems: Software, Part I

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

A walk in the forest…

Systems Thinking teaches us how to scale our perspective to study the forest or the trees, while Systems Engineering tells us what to do with the data we find.

Visitors: Where in the World?