Jump to content

Simple error in Regex (Stripping URL from Anchor Tag)


dhcrusoe

Recommended Posts

Hey all,

 

I'm working on a relatively simple regex to strip the test.mp3 (filename) from the following code:

 

<a href="http://www.wowshowcase.org/showcase/assets/Destiny_By_Design_Spring_09a.mp3">Destiny by Design</a>

 

with this regex:

 

var audiofile = vRows[i].firstChild.nodeValue.replace(/<a[^href]+href=\"([^\"]*)\"[^>]*>/ig,"$1");

 

and the result is...

 

Destiny_By_Design_Spring_09a.mp3Destiny by Design</a>

 

Hmm... any suggestions? (Trying to get an embedded player working; the click-to-download thing kinda stinks!) Thanks so much!

 

--Dave

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.