Turn web addresses starting with neither the http-protocol nor the www-prefix into links

Created on 13 June 2013, about 12 years ago
Updated 21 June 2025, 3 days ago

Not all web addresses turn into links. Currently, only web addresses starting with the protocol ('http(s)://') or the 'www' prefix will turn into links. Use of the www prefix is declining and excludes valid web addresses like:

facebook.com
drupal.org
bit.ly/QtQET
data.worldbank.org
en.wikipedia.org/wiki/Uniform_resource_locator

Proposed solution

We now have a regex matching on http and www, but we could include a third option: match on the known top level domains (generic and countries).

Two improvements we could do:

1. We could introduce matching to a valid top level domain. We then have to include the 220 top level domains (org|com|uk|ly etc) and that will fix the addressses above.

2. Matching the new private TLD's (*.anything) will be probably harder if we don't want false positives.
If such a TLD-address has a trail we could probably safely match them:
example.example/page/1

Resources

Twitter does a very good job to convert all kind of URL's in all kind of situations to shortener links.
Code can be found here:
https://github.com/twitter/twitter-text-js/blob/master/twitter-text.js
A PHP version based on that code is created here: https://github.com/stephenbeckett/TwitterURLMatchPHP
See http://www.stevebeckett.com/twitter-url-match-for-php/

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

filter.module

Created by

πŸ‡³πŸ‡±Netherlands hanno

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024