Regex returns string undefined

前端 未结 4 1161
死守一世寂寞
死守一世寂寞 2021-01-29 13:23

I am trying to extract hash value from an magnet link but it returns undefined

var tesst = \"magnet:?xt=urn:btih:2B78EDFDDC87DC9605FB285997A80B787888C19         


        
4条回答
  •  感情败类
    2021-01-29 14:18

    You can use this regex

    /([^:]+)&$/
    

    and use test[1]

    console.log(str.match(/([^:]+)&$/)[1]);
    

提交回复
热议问题