I have tried using getAttribute() before I moved on to using regular expressions. Your code works! May be I have missed something.