title: Ingore string using QRegExp
body: <p>I have a string in following format</p>
  
  <p>qString path = <a href="https://user:pass@someurl.com" rel="nofollow noreferrer">https://user:pass@someurl.com</a></p>
  
  <p>I want to ingore username and password from the the above path using QRegExp.
  An worked with following case also</p>
  
  <p><code>1. qString path = http://user:pass@someurl.</code></p>
  
  <p>In the below case if it is does not contain any user name or passwod then return the string</p>
  
  <pre><code>2. qString path = https://someurl.com
  </code></pre>
  
  <p>My code is worked with http and https, Is there any best approach to do that is short and simple manner. please suggest</p>
  
  <pre><code>f(Path.startsWith("https://") == true)
  {
      QRegExp UserPwd("(.*)(https://)(.*)(.*)", Qt::CaseInsensitive, QRegExp::RegExp);
      QRegExp UserPwd1("(.*)(https://)(.*)@(.*)", Qt::CaseInsensitive, QRegExp::RegExp);
  
      if(UserPwd1.indexIn(ErrorString) != -1)
      {
          (void) UserPwd1.indexIn(Path);
          return UserPwd1.cap(1) + UserPwd1.cap(2) + UserPwd1.cap(4);
      }
      else
      {
          (void) UserPwd.indexIn(Path);
          return UserPwd.cap(1) + UserPwd.cap(2) + UserPwd.cap(3);
      }
  }
  else
  {
      QRegExp UserPwd("(.*)(http://)(.*)@(.*)", Qt::CaseInsensitive, QRegExp::RegExp);
      (void) UserPwd.indexIn(Path);
      return UserPwd.cap(1) + UserPwd.cap(2) + UserPwd.cap(4);
  }
  </code></pre>