Perhaps some crude regex-solution? Should be fairly easy, does not need to be 100% correct all the time.