SHOW:
|
|
- or go back to the newest paste.
1 | const QString tempstring1 = "^" | |
2 | // Identifier for http and ftp | |
3 | "(?:(?:https?|ftps?)://)?" | |
4 | // user:pass authentication | |
5 | "(?:\\S+(?::\\S*)?@)?" | |
6 | "(?:" | |
7 | // IP address dotted notation octets | |
8 | // excludes loopback network 0.0.0.0 | |
9 | // excludes reserved space >= 224.0.0.0 | |
10 | // excludes network & broacast addresses | |
11 | // (first & last IP address of each class) | |
12 | "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" | |
13 | "(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" | |
14 | "(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" | |
15 | "|" | |
16 | // host name | |
17 | "(?:(?:[_a-z\\x{00a1}-\\x{ffff}0-9]-*)*[a-z\\x{00a1}-\\x{ffff}0-9]+)" | |
18 | // domain name | |
19 | "(?:\\.(?:[a-z\\x{00a1}-\\x{ffff}0-9]-*)*[a-z\\x{00a1}-\\x{ffff}0-9]+)*" | |
20 | // TLD identifier | |
21 | "(?:\\.(?:[a-z\\x{00a1}-\\x{ffff}]{2,}))" | |
22 | "\\.?" | |
23 | ")" | |
24 | // port number | |
25 | "(?::\\d{2,5})?"; | |
26 | QRegularExpression getDomain(tempstring1, QRegularExpression::CaseInsensitiveOption); | |
27 | QString tempString = string; | |
28 | QStringList list1 = tempString.split(getDomain); | |
29 | ||
30 | - | QString lowercaseLinkString = list1[0] + list1[1]; |
30 | + | QString lowercaseLinkString = list1[0].toLower() + list1[1]; |
31 | ||
32 | link = Link(Link::Url, linkString); | |
33 | textColor = MessageColor(MessageColor::Link); | |
34 | this->emplace<TextElement>(lowercaseLinkString, TextElement::LowercaseLink, | |
35 | textColor) | |
36 | ->setLink(link); | |
37 | this->emplace<TextElement>(string, TextElement::OriginalLink, textColor) | |
38 | ->setLink(link); |