How js automatically recognizes Url in content and adds hyperlinks

for example, in a chat, the text sent by the other party contains an address, then it is directly displayed in the form of a hyperlink
hyperlink may have http, or not
for example,
https://baidu.com
http://baidu.com
www.baidu.com
this rule does not recognize the beginning of www, but can only recognize
< div id= "text" >
www.baidu.com
www.baidu.com
< / div >
< script type= "text/javascript" >
var txt = document.getElementById ("text"). InnerHTML;
var regexp = / (http://|https://)((w|=|?|.|/|&|-)+)/g; / / regular match
txt1=txt.replace (regexp,function ($url) {

)
return "<a href="" + $url + "" target="_blank">" + $url + "</a>";

});
document.getElementById ("text") .innerHTML = txt1
/ / alert (txt.replace (regexp, "m"));
/ / alert (txt);
< / script >

)
Apr.05,2021

js regular
let expr = / 1 < / sup > +? href= [']? (< sup id= "fnref-2" > 2 < / sup > +) [']? < sup id= "fnref-1" > 1 < / sup > * > (< sup id= "fnref-3" >) -ref "> 3 < / sup > +) / mg

< hr >
    < li id= "fn-1" > > < li id= "fn-2" > "' please < li id= "fn-3" > < please
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e48a5b-44cda.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e48a5b-44cda.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?