Martin Spedding's Blog

Adventures in a disconnected world

January 2004 - Posts

David Chappell has a blog

David Chappell, one the top speakers on the circuit, has a blog. But sadly it is missing two main features of a blog - an rss feed and comments. (http://www.davidchappell.com/blog/)

As anyone who has heard David speak or has read his Opiniari newsletter. his blog will definitely be worth reading.

How on earth can regex expression return a match which throws the exception "Input string was not in a correct format" ?

First of all happy new year to everyone where ever you live.

I have not blogged for a while has I have been very busy and also suffering from a viral infection.

I decided to complete a personal project I have been working on : creating an rss feed from my yahoo email. Everything was going wonderfully well until I tried to extract the data I need from the html page received from yahoo when you view you Yahoo inbox. Even though I am no expect in Regular Expressions I decided to have a go. I was using the appropriate .Net framework classes and looping through the collection of matches. The problem was that sometimes an exception would be thrown : "Input string was not in a correct format" . I patiently searched using Google to find the explanation of how a regex expression passing text contained in a string could be in the wrong format. Maybe someone can explain this exception as to me it defeated my ability to use regular expressions. Is it a bug or am I just being stupid.

I spent hours trying to solve this problem. In the end I just used a combination of indexOf and substring to achieve the same effect as I would have done with the regex. Performance was great and it was much simpler to debug and program than the regex version.

My conclusion is if plan A does not work use plan B and often the old fashioned ways work best.

More Posts