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.