Url regular expression

see a url regular expression on the Internet:

(https?|ftp|file)://[-A-Za-z0-9+&@-sharp/%?=~_|!:,.;]+[-A-Za-z0-9+&@-sharp/%=~_|]
The expression

must start with http: , and
if you don"t need http:, you can also . How can I modify it? The following
/ / www.baidu.com

Mar.13,2021

? means that the previous content matches 0 or 1 times. Add ? after (https? | ftp | file): ) to indicate that the previous content can appear 0 times or 1 times, that is to say, there can be protocols or no protocols in url .

(?:(https?|ftp|file):)?//[-A-Za-z0-9+&@-sharp/%?=~_|!:,.;]+[-A-Za-z0-9+&@-sharp/%=~_|]

I don't know if you use it in js. If you use it in js, these two / / need to be escaped:

let reg = /(?:(https?|ftp|file):)?\/\/[-A-Za-z0-9+&@-sharp/%?=~_|!:,.;]+[-A-Za-z0-9+&@-sharp/%=~_|]/

-sharp | http
(https?|http|ftp|file)
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-1b3a884-2c214.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-1b3a884-2c214.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?