(https?://(?:www.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9].[^s]{2,}|www.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9].[^s]{2,}|https?://(?:www.|(?!www))[a-zA-Z0-9]+.[^s]{2,}|www.[a-zA-Z0-9]+.[^s]{2,})
^http[s]?://(www.)?(.*)?/?(.)*
// All are 'non-capturing' regular expressions.
// General format of a URL in a RegEx:
(?:(?:https?|ftp)://)?(?:www.)?[^/
]+(?:/[^
]*)?
// To enforce the protocol
(?:https?|ftp)://(?:www.)?[^/
]+
// To enforce the protocol and trailing slash
(?:https?|ftp)://(?:www.)?[^/
]+(?:/[^
]*)
// To enforce file extensions like .html or .png:
(?:(?:https?|ftp)://)?(?:www.)?[^/
]+(?:/[^
]*)(?:[a-zA-Z0-9]+.(?:html|png|webp|js))
// To implement in GO (https://go.dev), add an extra backslash (' ') to every unescaped backslash (' ')
// For the first format, that is:
(?:(?:https?|ftp)://)?(?:www.)?[^/
]+(?:/[^
]*)?
// You do not need to add the extra backslash to the '
' and '
' because it is handled natively
/(?:(?:https?|ftp|file)://|www.|ftp.)(?:([-A-Z0-9+&@#/%=~_|$?!:,.]*)|[-A-Z0-9+&@#/%=~_|$?!:,.])*(?:([-A-Z0-9+&@#/%=~_|$?!:,.]*)|[A-Z0-9+&@#/%=~_|$])/igm
// It will include the space before as well (if it has one)
/(^| )(https?://)?(www.)?[-a-zA-Z0-9@:%._+~#=]{1,256}.[a-zA-Z0-9()]{1,8}([-a-zA-Z0-9()@:%_+.~#?&//=]*)/gi
^(ht|f)tp(s?)://[0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*(:(0-9)*)*(/?)([a-zA-Z0-9-.?,'/+&%$#_]*)?$
/^https?://(?:www.)?[-a-zA-Z0-9@:%._+~#=]{1,256}.[a-zA-Z0-9()]{1,6}(?:[-a-zA-Z0-9()@:%_+.~#?&/=]*)$/