?! is the negative lookahead operator, it doesn't work for stuff before. What you can do is to have a non-capturing group to define a group that starts the line with ^https?://.*

I haven't tested it, but it should look like:

Qt Code:
  1. QRegExp rx("(?:^(?:ftp|http|https)://.*$)?//(\\w+)");
To copy to clipboard, switch view to plain text mode 

I am not sure of the usage of a non-capturing group within a non-capturing group. You might need to use (?:ftp://.*|http://.*|https://.*) instead.

- Maxime