-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from QRegExp to QRegularExpression for Qt6 compatibility #2124
Conversation
a3839a7
to
8df207c
Compare
Also took the opportunity to improve the URL regex so that it didn't swallow up terminating punctuation characters (such as full stop) into the hyperlink. It was based on the tested behaviour of clients such as Outlook which automatically convert plain text URLs into hyperlinks, and exclude certain terminating characters from the link when doing so (not just based on white space). |
@jamulussoftware/maindevelopers anyone object to this being merged? |
@softins, in the URL regexp change, why is the negative lookahead assertion (the |
It's not duplicated. One of them matches a single character class, and the other matches a The behaviour with Maybe I should add an explanatory comment... |
You'd have to step through the full regexp if you do. That would help in future, though. |
The regex could probably be improved; it did cause me a bit of head scratching! I would be open to suggestions. The intent is to exclude from the end of the URL characters that may well be legal within the URL. I searched without success for a standard, official regex to do it. There were many different home-grown suggestions for validating a standalone URL, but not for identifying the extent of a URL within a surrounding string. |
Co-authored-by: Noam Postavsky <npostavs@gmail.com>
Anyone else want to review or comment? Otherwise I'll admin-merge it. |
Looks good to me! |
Short description of changes
Migrate QRegExp to QRegularExpression for compatibility with both Qt5 and Qt6
Context: Fixes an issue?
Prerequisite for supporting Qt6. The code for
src/util.cpp
was taken from the comment by @ngocdh at#1999 (comment)
Should ease further work towards Qt6, particularly the draft PR in #1999
Does this change need documentation? What needs to be documented and how?
No
Status of this Pull Request
Tested on Qt5 to ensure backward compatibility. Not tested on Qt6, but should be identical by design.
What is missing until this pull request can be merged?
Ready to merge.
Checklist