'How can I "Find and Replace" specific characters inside TAGS using ATOM?

I need help replace the - inside my alt tags only (not the rest of the code/html).

bad: alt="Tumble-drying-allowed"

good: alt="Tumble drying allowed"

I'm using ATOM and the REGEXP tutorials are foreign to me. (so weird to look at)

Any help would be greatly appreciated.

<td data-colname="File"><strong><img title="Tumble-drying-allowed"
src="wp-content/uploads/2022/01/Tumble-drying-allowed.svg"
alt="Tumble-drying-allowed" width="31.18" height="31.48" />Tumble-drying-allowed</strong>
File name:Tumble-drying-allowed.svg</td>

Eventually I'll target the title tag too, but I need a head start



Solution 1:[1]

Here is a regex string which will find alt= + a string joined by hyphens

alt=['"]{1}([A-Za-z]*[\-]{1})*[A-Za-z]*["']{1}

and here is one the find alt= + a string joined by spaces

alt=['"]{1}([A-Za-z]*[ ]{1})*[A-Za-z]*["']{1}

Over to you to see how you use them in atom-editor. NB I've made it so that it will find '' or "" as string delimiter. Your might have a problem with these characters if you use it in a script.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1