JS Regex to find href of several a tags

后端 未结 9 1148
野性不改
野性不改 2020-12-28 08:04

I need a regex to find the contents of the hrefs from these a tags :

9条回答
  •  一生所求
    2020-12-28 09:06

    how about spaces around = ? this code will fix it:

    var matches = str.match(/href( *)=( *)("|'*)(.*?)("|'*)( |>)/);
    console.log(matches);
    

提交回复
热议问题