Advertisement
Lajamerr_Mittesdine

domain lowercase

Jul 18th, 2018
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const QString tempstring1 =
  2.         "^"
  3.         // Identifier for http and ftp
  4.         "(?:(?:https?|ftps?)://)?"
  5.         // user:pass authentication
  6.         "(?:\\S+(?::\\S*)?@)?"
  7.         "(?:"
  8.         // IP address dotted notation octets
  9.         // excludes loopback network 0.0.0.0
  10.         // excludes reserved space >= 224.0.0.0
  11.         // excludes network & broacast addresses
  12.         // (first & last IP address of each class)
  13.         "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])"
  14.         "(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}"
  15.         "(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))"
  16.         "|"
  17.         // host name
  18.         "(?:(?:[_a-z\\x{00a1}-\\x{ffff}0-9]-*)*[a-z\\x{00a1}-\\x{ffff}0-9]+)"
  19.         // domain name
  20.         "(?:\\.(?:[a-z\\x{00a1}-\\x{ffff}0-9]-*)*[a-z\\x{00a1}-\\x{ffff}0-9]+)*"
  21.         // TLD identifier
  22.         "(?:\\.(?:[a-z\\x{00a1}-\\x{ffff}]{2,}))"
  23.         "\\.?"
  24.         ")"
  25.         // port number
  26.         "(?::\\d{2,5})?";
  27. QRegularExpression getDomain(tempstring1, QRegularExpression::CaseInsensitiveOption);
  28. QString tempString = string;
  29. QString domain = getDomain.match(tempString).captured(0);
  30. QString lowercaseLinkString = string;
  31. lowercaseLinkString.replace(domain, domain.toLower());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement