In my usual late-adopter fashion, I only recently made the move to an iPhone 3G from a Palm Treo 650. (The change was precipitated by worry over more frequent Treo crashes, chronic dissatisfaction with syncing, and a growing annoyance with Verizon’s website —rather than from Shiny Gadget Curiosity. Obviously, such Curiosity is now amply present!) Updating went well, as did a very fast sync.
Since I keep all too many calendar entries (a habit developed with my old Palm V in the late 1990s), I checked the entries in iCal. They had transferred over, after some brief redundancy, removal and restoration dances (i.e., import recent calendar-name.ics as a New Calendar, verify data, then remove older version of calendar). But, I confess I hadn’t bothered to check the entry details like time, repetition and notes.
Well, well, well. Those entry notes. If I had written a note, it was there. But whether or not I did, nearly all calendar entries had nonsensical strings inserted into the note field.
~Oh, joy~. Who was to blame? Palm? DateBk5? Or Missing Sync? Garden gnomes?
But there was a definite pattern: some variation of DESCRIPTION:##@@X@@@@@@@@@@@@@@, where X is a letter, followed by a carriage return. This covered the vast majority of those superfluous strings. An excellent candidate for cleanup with regular expressions!
The recipe involves exporting each calendar from iCal, editing them in either TextWrangler or Smultron for the regex support, then doing the reimport dance. (Although in my case, I had too many calendars from the multiple categories from DateBk5, so initially had to do some calendar merging.)
I made three different types of regular expressions, in the following order below, to find the troublesome strings. Then in three passes per calendar file, I replaced strings with nothing (empty string). The first one gets rid of notes containing only the extraneous string, whereas the third regex (which needs to be the last pass) doesn’t erase the entire note field if a legitimate one exists (because it still begins with DESCRIPTION:), but only removes the junk and preserves the real note. The second regex is similar to the first one (an entirely junk string), with an additional string of [Link-blah].
^DESCRIPTION:##.+@@@.+@\\n$\r ^DESCRIPTION:##.+@@@.+@\\n\[Link.+\]\\n$\r ##.+@@@.+@\\n
The caret (^) looks for DESCRIPTION:## at the beginning of the first two regexen. Then, since every instance of the extraneous string contains ## followed by one or two letters, plus at least three @-signs followed by \n, the phrase ##.+@@@.+@\\n neatly takes care of that portion! This Basic Syntax Reference sums up what each of those regex special characters do.
Now I need to somehow transfer my memos and lists, which means something better than the iPhone’s default Notes application. That’s gonna be a royal pain, since there’s currently no clear way to transfer Palm databases over to the iPhone.

Submit a comment