There is an arbitrary text, once entered by the user.
How to automatically select all the hyperlinks in it?
What rules for the formation of hyperlinks should be considered?
- It starts with the protocol: http, https, ftp.
- Starts with
www. - Starts with
//. - It ends with a space or a punctuation mark, except for the opening bracket and a point.
- Does not include the point if it is followed by a whitespace character.
- It does not end with a closing parenthesis if it contains a pair opening.
What else should be considered?
The link never links to the same site.
Perhaps there are some common ways to highlight links?