On Wed, Sep 21, 2011 at 07:42:04AM -0700, Brian wrote: > I have an XML document which uses self-closing tags containing id > attributes of varying length for a variety of different elements. I > need to convert these to opening and closing tags which contain the > attribute value. For example I need to change: > > <BaseVehicle id="5888"/> > <Position id="22"/> > > Into: > > <BaseVehicle>5888</BaseVehicle> > <Position>22</Position> > > I'm perfectly happy to change just one tag type at a time, for example > all <BaseVehicle> tags and then run it again to change all <Position> > and other tag types in the document. Any help anyone can offer would > be tremendously appreciated. Thanks!
I believe you want something like this: Find <([a-zA-Z]+)\s+id="(\d+)"/> Replace <\1>\2</\1> If there are some tags you don't want to change, you could explicitly list the ones you do want to change, like this: Find <(BaseVehicle|Position)\s+id="(\d+)"/> Ronald -- You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at <http://groups.google.com/group/bbedit?hl=en> If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
