0002-improve-URI-detection.patch
src/uisupport/clickable.cpp | ||
---|---|---|
50 | 50 |
// (RegExps are not constant while matching, and they are static here for efficiency) |
51 | 51 |
ClickableList ClickableList::fromString(const QString &str) { |
52 | 52 |
// For matching URLs |
53 |
static QString scheme("(?:(?:mailto:|(?:[+.-]?\\w)+://)|www(?=\\.\\S+\\.))"); |
|
54 |
static QString authority("(?:[,.;@:-]?\\w+)+(?::\\d+)?"); |
|
55 |
static QString urlChars("(?:[,.;:\\w~@/?&=+$()!%#*|{}\\[\\]'^-])"); |
|
53 | 56 |
static QString urlEnd("(?:>|[,.;:\"]*\\s|\\b|$)"); |
54 |
static QString urlChars("(?:[,.;:]*[\\w\\-~@/?&=+$()!%#*|{}\\[\\]'^])"); |
|
55 | 57 | |
56 | 58 |
static QRegExp regExp[] = { |
57 | 59 |
// URL |
58 | 60 |
// QRegExp(QString("((?:https?://|s?ftp://|irc://|mailto:|www\\.)%1+|%1+\\.[a-z]{2,4}(?:?=/%1+|\\b))%2").arg(urlChars, urlEnd)), |
59 |
QRegExp(QString("\\b((?:(?:mailto:|\\w+://)|www\\.)%1+)%2").arg(urlChars, urlEnd), Qt::CaseInsensitive),
|
|
61 |
QRegExp(QString("\\b(%1%2(?:/%3*)?)%4").arg(scheme, authority, urlChars, urlEnd), Qt::CaseInsensitive),
|
|
60 | 62 | |
61 | 63 |
// Channel name |
62 | 64 |
// We don't match for channel names starting with + or &, because that gives us a lot of false positives. |
63 |
- |