Regular Expression to Extract the Url out of the Anchor Tag

前端 未结 3 553
隐瞒了意图╮
隐瞒了意图╮ 2020-12-11 12:54

I want to extract the http link from inside the anchor tags? The extension that should be extracted should be WMV files only.

3条回答
  •  抹茶落季
    2020-12-11 12:55

    I wouldn't do this with regex - I would probably use jQuery:

    jQuery('a[href$=.wmv]').attr('href')
    

    Compare this to chaos's simplified regex example, which (as stated) doesn't deal with fussy/complex markup, and you'll hopefully understand why a DOM parser is better than a regex for this type of problem.

提交回复
热议问题