For both cases have a look at QRegExp http://doc.qt.io/qt-5/qregexp.html
I looked at that, and the QRegularExpression equivalent for QTextDocument::find(). All of the find() methods return a QTextCursor pointing to the first position in the found string (if any). Then what? I think the OP is having the same problem that I could see at that point - there is no way to retrieve the full text fragment that was matched by the regexp and highlight (select) it. QTextCursor gives you four ways to select text: whole document, block under cursor, line under cursor, or word under cursor.

None of these will work for a URL - as I think the OP is seeing, "WordUnderCursor" breaks at the first non-character position, which is the "@" symbol in his examples.

So the bottom line question is, how do you find and highlight an arbitrary string in a QTextDocument?