Home Download Buy Blog Forum Support

Selectively changing tag attributes with regex or xpath

Selectively changing tag attributes with regex or xpath

Postby ezuk on Thu Apr 11, 2013 8:36 am

Hello,

I have an HTML snippet containing multiple IMG tags. The first tag needs to get a class "firstImage" while all other img tags need to get class "bodyImage".

I was able to easily make a regex that puts bodyImage as the attribute for all tags. That's fine and saves me time, but it's a partial solution (and a bit of a hack as I'm using regex to edit XML, never a good idea).

Ideally I would like to use xpath expressions to do this. Is there any way to do it in Sublime?
ezuk
 
Posts: 1
Joined: Thu Jan 03, 2013 5:04 pm

Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 21 guests