Open iteles opened 8 years ago
:+1:
/(https?:)*\/\/[\w.\/?&@:%._\+~#=]*\b/g
can be used to detect URLs and replace with links.
http://regexr.com/3f3bq
const text = `foo@demo.net bar.ba@test.co.uk
www.demo.com http://foo.co.uk/x
http://regexr.com/foo.html?q=bar&baz=new&q=a+b
https://mediatemple.net
//www.google.com
demo.google.com`;
let formatedText = text.replace(
/((https?:)*\/\/[\w.\/?&@:%._\+~#=]*\b)/gi,
'<a href="$1">$1</a>'
);
console.log( formatedText );
Currently I think this is being done by remarkable
It would be a nice enhancement (low priority) to automatically detect URLs in the markdown and convert them into HTML links
<a>
elements.This example is from: http://ampl-demo.herokuapp.com/dwyl/learn-react