cari

Rumah  >  Soal Jawab  >  teks badan

求一java正则表达式

黄舟黄舟2802 hari yang lalu661

membalas semua(1)saya akan balas

  • 迷茫

    迷茫2017-04-18 10:47:21

    var url = "http://www.xxx.com/1/2";
    var reg = /^(http:\/\/){1}(\w+)(\.){1}(\w+)(\.){1}(\w+)(\/\w)*$/g;
    var newUrl = "";
    
    if(reg.test(url)){
      newUrl = "<a href='" + url + "'>";
    }
    
    console.log(newUrl);
    
    //result: '<a href=\'http://www.xxx.com/1/2\'>'

    balas
    0
  • Batalbalas