Hmmm... can't you do that with the replacement code or using the extraction method? There obviously has to be a link to the popup (which is what I would extract)
Maybe if you give me a link as an example I can get a better idea or offer some suggestions. Just remember that I am on vacation and I don't have regexp buddy installed on this box so I don't want to spend to much time getting caught up in Regexps