Regular Expressions to the rescue

The CMS thing (currently being worked on for was doing fine but for one small problem – parsing hyperlinks.

I had tried to use a system of splitting the html on “index.asp?id=123” but all kinds of problems started to crop up (particularly where hyperlinked images were concerned).  The more attempts to code exceptions and work-arounds, the more problems seemed to arise – a script hydra no less.

Then suddenly it dawned on me that what I really was doing was searching the html for a specific tag and replacing the “index.asp?id=1” or whatever, with just “home”, and then reversing the process on the update to the database. The point is that the best and most powerful way to the pattern match strings is to use Regular Expressions. Hurrah! Problem well on the way to being solved.I’ll put in some basics about regular expressions in the Wiki sometime soon. Meantime, I’m signing off for 2006 so Happy New Year to my many readers (hello mum).


About this entry