Translate

href value with regex etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
href value with regex etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

18 Haziran 2020 Perşembe

Take href value with regex


https://regexr.com/

<a href="https://deneme/">https://deneme/</a>

Take href and change



var replacePattern = /(\<a([^>]*?)(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
resp.eulaTextUrl = resp.eulaTextUrl.replace(replacePattern'$1?openInExternalBrowser=true" target="_blank');




 var httpPattern = /(\<a([^>]*?)(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
      resp.eulaTextUrl = resp.eulaTextUrl.replace(httpPattern'$1?openInExternalBrowser=true" target="_blank');
      var mailPattern = /(\<a([^>]*?)(mailto):[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
      resp.eulaTextUrl = resp.eulaTextUrl.replace(mailPattern'$1?openInExternalBrowser=true" data-rel="external');

https://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links/21925491


function linkify(inputText) {
    var replacedText, replacePattern1, replacePattern2, replacePattern3;

    //URLs starting with http://, https://, or ftp://
    replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
    replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');

    //URLs starting with "www." (without // before it, or it'd re-link the ones done above).
    replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
    replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');

    //Change email addresses to mailto:: links.
    replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim;
    replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');

    return replacedText;
}

Bu Blogda Ara