Extract HTML option values from tag values
Generate HTML option values from the text in the option tag. If the text contains multiple words, replace the spaces with an underscore and convert all capital letters to small letters.
Start file
<select> <option>Volvo</option> <option>Aston Martin</option> <option>Audi</option> <option>Alfa Romeo</option> </select>
End file
<select> <option value="volvo">Volvo</option> <option value="aston_martin">Aston Martin</option> <option value="audi">Audi</option> <option value="alfa_romeo">Alfa Romeo</option> </select>
View Diff
2,5c2,5 < <option>Volvo</option> < <option>Aston Martin</option> < <option>Audi</option> < <option>Alfa Romeo</option> --- > <option value="volvo">Volvo</option> > <option value="aston_martin">Aston Martin</option> > <option value="audi">Audi</option> > <option value="alfa_romeo">Alfa Romeo</option>
Solutions
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
Unlock 43 remaining solutions by signing in and submitting your own entry
#44 Matt Walsh / @wattmalsh - Score: 52 - 02/06/17 @ 02:54
qqj0f>lyithi value=""<Esc>hpvi"uvi":s/\%V /_/g<CR>q@q@@@@ZZ
0 comments