Regex URL Path from URL

后端 未结 9 2832
情歌与酒
情歌与酒 2021-02-19 13:57

I am having a little bit of regex trouble.

I am trying to get the path in this url videoplay.

http://video.google.co.uk:80/videoplay?docid=-         


        
9条回答
  •  無奈伤痛
    2021-02-19 14:29

    var subject =
    '';
    var re=/\"[a-z]+:\/\/[^ ]+"/m;
    document.write(subject.match(re));

    You can try this

    /\"[a-z]+:\/\/[^ ]+/
    

    Usage

    if (/\"[a-z]+:\/\/[^ ]+/m.test(subject)) {  // Successful match } else {    // Match attempt failed }
    

提交回复
热议问题