fork download
  1. <?php
  2.  
  3. $str = 'https://v...content-available-to-author-only...1.com/ https://v...content-available-to-author-only...2.com/ https://v...content-available-to-author-only...3.com/
  4. https://content-available-to-author-only.com/ https://content-available-to-author-only.com/ https://content-available-to-author-only.com/';
  5. $re = '/(?<!=")(\b[\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i';
  6. echo preg_replace($re, '<a href="$1" target="_blank">$1</a>', $str);
Success #stdin #stdout 0.02s 23724KB
stdin
Standard input is empty
stdout
<a href="https://v...content-available-to-author-only...1.com/" target="_blank">https://v...content-available-to-author-only...1.com/</a> <a href="https://v...content-available-to-author-only...2.com/" target="_blank">https://v...content-available-to-author-only...2.com/</a> <a href="https://v...content-available-to-author-only...3.com/" target="_blank">https://v...content-available-to-author-only...3.com/</a>
<a href="https://content-available-to-author-only.com/" target="_blank">https://content-available-to-author-only.com/</a> <a href="https://content-available-to-author-only.com/" target="_blank">https://content-available-to-author-only.com/</a> <a href="https://content-available-to-author-only.com/" target="_blank">https://content-available-to-author-only.com/</a>