Skip to content

Twitter shortened URLs are not removed #587

Description

@plablo09

The regular expression that removes URLs is expecting at least two characters in the domain name part. Since Twitter shortens URLs as https://t.co/something these URLs are not removed.

I fixed this in my own fork. The fix is quite simple, just change:

URLREGEX <- "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,4}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)"

to

URLREGEX <- "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-z]{2,4}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)"

In both tokenize.R and tokens.R

Maybe a pull request?
Or this is just too simple and may be easier to fix directly on this repo

Regards

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions