Rami
Rami

Reputation: 13

Altering HTML tags using Notepad++

I have a long list of HTML tags like the following:

<option>text 1</option>
<option>text 2</option>

etc...

I wish to use Notepad++ to make my list look like the following:

<option value="text 1">text 1</option>
<option value="text 2">text 2</option>

Thanks

Upvotes: 1

Views: 296

Answers (3)

CodingGorilla
CodingGorilla

Reputation: 19842

As far as a regex find/replace, try this:

Find: <option>([\w\s]+)</option>
Replace: <option value="\1">\1</option>

Upvotes: 0

Cajunluke
Cajunluke

Reputation: 3113

Use a regular expression?

Find: <option>([^<]+)</option>

Replace: <option value="\1">\1</option>

Then use individual find/replace so you don't accidentally clobber something you didn't intend to.

Upvotes: 3

Randy
Randy

Reputation: 16677

create a macro.
this looks like a nice repeating keystroke sequence.

Upvotes: 0

Related Questions