Need help with regex to find and replace


Hallo all,

i would really appreciate if someone could help me with a regex.

I have different font icons:

Some of them have the attribute aria-hidden=“true” and some of them they don’t. I want to target all icons without the attribute and add them the attribute:

For example the icon

should be replaced with

Any ideas?


I’m guessing those icons were html code? On here you’ll have to put html into code blocks for others to read it, i.e.:

`<img src="source.gif"/>`


<i class="fa fa-sign-in"></i>
<i class="fa fa-user-plus"></i>
<i class="fa fa-tag"></i>
<i class="fa fa-home" aria-hidden="true"></i>

<i class="fa fa-sign-in"></i>
should replaced with

<i class="fa fa-sign-in" aria-hidden="true"></i>


Sorry for the multiple posts. Tried to figure out how to add the html code. Thanks Songworks


SEARCH: (class=\"[^"]+\")>
REPLACE: $1 aria-hidden="true">


Thank you very much danPadric!