There is some arbitrary text that was once entered by the user.

How to automatically select all hyperlinks in it?
What rules for the formation of hyperlinks should be taken into account?

  • Begins with protocol: http, https, ftp, ftps.
  • Starts withwww.
  • Starts with//.
  • Ends with a space or punctuation mark, except for an opening parenthesis and a period.
  • Does not include a period if it is followed by a whitespace character.
  • Does not end with a closing bracket if it contains a matching opening bracket.

What else should I consider?

A link never refers to the same site.

Perhaps there are some common ways to highlight links?


Your question there is generally deleted and the redirect goes to the answer from another similar question.

Visman2022-01-14 02:33:12

@Visman, not removed but marked as duplicate

Grundy2022-01-14 02:33:12