News for hackers. Stuff that matters.
Re:Show HN: Set NASA APOD as Ubuntu Desktop Background by magic_haze on Sunday July 29, 2012 @08:00PM (#4310250)
ah, good to see the old regex for <a href="(image.?)"

I wrote a little parser for this site a while back to display the daily photo as a desktop gadget, and had to resort to the same hack to get the image out. It's a shame there isn't a rss feed for this yet.. it is a bit hard to be believe that in this day and age, thousands of pieces of code around the world are relying on how one guy decided to write his html.

[Ninja Edit:] For what it is worth, here's the regex I actually ended up using:

    ^<a\s*?href\s*?=\s*?['"](image/.+?)\1\s*?>$
but obviously, this is equally fragile.
Re:Show HN: Set NASA APOD as Ubuntu Desktop Background by randomdrake on Sunday July 29, 2012 @08:44PM (#4310373)
I plan on using an actual DOM parser on my next pass as I fully stand by and believe that you should never parse markup with regex.

http://stackoverflow.com/a/1732454