DRK
DRK

Reputation: 91

Regex to replace <a> href and <img> alt in Notepad++

I'm trying to do a search and replace across a lot of files and I need to format the following HTML.

<a href="http://www.XXXXXXXXX.com target=_blank">
<img alt="XXXXXXXXX" src=http://domain.org/files/image.gif" />
</a>

I need regex for the XXXXXXX parts. Basically find all combinations of the domains used and all combinations of the alt words used.

Some domains have 1 - (dash) and others have 2 - (dashes) in them while the rest do not. Some alt images are 2 words while others are 3. There are no numbers in the domain or alt tags.

Any help would be greatly appreciated.

Upvotes: 0

Views: 1095

Answers (1)

vsh
vsh

Reputation: 160

Replace:

a href="http://www\..+\.com\ +target

with

a href="http://www.NEWVALUE.com target

Replace:

img alt="[^"]+"\ +src=

with

img alt="NEWVALUE" src=

Upvotes: 2

Related Questions