How can I find all attributes with single quotes in a Sublime Text 2 document and replace with double quotes?

Posted by Brandon Durham on Stack Overflow See other posts from Stack Overflow or by Brandon Durham
Published on 2012-11-14T16:58:24Z Indexed on 2012/11/14 16:59 UTC
Read the original article Hit count: 269

Filed under:
|

I'm feeling particularly nit-picky today. I'm working in some HTML docs that have single quotes around all attribute values through the docs, like this:

<div class='classone classtwo'>

I'd love to be able to do a find-and-replace in each doc and replace with double quotes, like this:

<div class="classone classtwo">

Many elements in the document will have multiple attributes:

<div class='classone classtwo' data-scripts='lazyload'>

And some will have the correct double quotes:

<div class='classone classtwo' data-scripts="lazyload">

What's the best way to replace all single quotes wrapping values with double?

© Stack Overflow or respective owner

Related posts about regex

Related posts about sublimetext2