Unless you need this to happen in front of people's eyes, you don't 
have to do it in Tex-Edit. You can operate on an Applescript string 
variable with the search features in the ACME Script Widgets or 
Satimage OSAXen. Finding what's between two underscores also could be 
a regular expression job.
-- 

Bill Steele
[log in to unmask]