hack : power find/replace text

this tip is borne out of frustration at seeing humans do things the hard way when there’s a perfectly simple, less insane way.

i need to convert text from a brief which looks like this :

into an applescript list that looks like this :

screengrab showing applescript list

transforming the text manually is about as inefficient as things get. this is an ideal job for find/replace. it just takes a few seconds to figure out the best way to attack it.

the trick is to remember that find/replace isn’t only for letters, words and spaces. it can also be used on invisible characters like tabs and line breaks.

this particular task can be achieved with just two find/replace passes – then a little cleanup.

any text editor will do, but for this kind of thing i always use BBEdit
(note : this is NOT a paid endorsement – i just love the app)

when i copy the text from word to BBEdit it looks like this :

the first pass changes the text between the numbers :

the second pass changes basically everything else :

(notice how BBEdit specifies the line break as ‘/n’ and the tab as ‘/t’)

then i just need to manually clean up the top and tail :

and we’re done.

keep grunting.