Tuesday, December 18, 2007

There are stars and then there are stars

Microsoft Word and Microsoft Excel are both fantastic programs that most of us use everyday. Personally I vote for Microsoft Excel as the best and most useful program ever written, but that is a completely different story. But it is funny to see how differently the two programs function despite both being developed by the very same company (but clearly by different departments).

Take searching in Word versus Excel. In Word you can replace an asterisk (*) with a B by simply using Find=* and Replace=B. So A*C becomes ABC.
It (kinda) makes sense, but in Excel the asterisk (*) is suddenly used as a wildcard character that you can not easily turn off. So A*C now becomes B as the whole cell is matched. God forbid someone as Microsoft should discover standard regular expressions.

But how do you then replace an plain asterisk (*) inside text in your Excel file. Well, it turns out that you put a tilde (~) in front of the asterisk. Yeah, don't ask me how tilde suddenly became the escape character instead of backslash. So when you use Find=~* and Replace=B, then
A*C correctly becomes ABC. Again, God forbid someone as Microsoft should discover regular expressions and using \ as the escape character.

Microsoft, in case you are listening, please add an option to use real UNIX style regular expressions. I mean it is a standard after all. But at least we have a way to replace asterisks in Excel.

Nifty.

No comments: