Moogal
Moogal

Reputation: 107

Regex replace in sublimetext2

I would like to use regex (preferably in sublimetext2) to replace the following:

<audio id="element29">
<source src="../../audio/sounds/01/mysound.mp3" type='audio/mpeg'>
<source src="../../audio/sounds/01/mysound.wav" type='audio/wav'>
</audio>

with this:

<?php audioButton("../../audio/sounds/01/mysound","mysound"); ?>

My regex skills are nonexistent, so I'll be most grateful if someone can help me out.

Upvotes: 0

Views: 61

Answers (1)

poke
poke

Reputation: 387537

Find what:

<audio id="element\d+">\s*(?:<source src="([^"]+/([^/]+))\.(mp3|wav)" type=[^>]+>\s*){2}</audio>

Replace with:

<?php audioButton("$1","$2"); ?>

Upvotes: 1

Related Questions