Skip to content

Commit a5b4a6a

Browse files
fix: update URL regular expression for improved accuracy
Modified the URL regular expression in the UrlFilter class to enhance its accuracy in matching valid URLs. The changes include adjustments to the port number matching logic, ensuring it correctly captures a wider range of valid port formats. Log: Improved URL matching in UrlFilter Influence: 1. Test URL filtering functionality with various URL formats 2. Verify that edge cases are handled correctly 3. Ensure no regressions in existing URL handling features bug: https://pms.uniontech.com/bug-view-349651.html
1 parent ef9c124 commit a5b4a6a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

3rdparty/terminalwidget/lib/Filter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,9 @@ void UrlFilter::HotSpot::activate(const QString &actionName)
523523
/** modify begin by ut001121 zhangmeng 20201215 for 1040-4 Ctrl键+鼠标点击超链接打开网页 */
524524
/** del
525525
const QRegularExpression UrlFilter::FullUrlRegExp(QLatin1String("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]]"));*/
526-
const QRegularExpression UrlFilter::FullUrlRegExp(QLatin1String("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[\\w-.@]+"
527-
"([:]((6553[0-5])|[655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[0-9])[^0-9])?"
528-
"([/][\\w\\-\\@?^=%&/~\\+#.]+)?"));
526+
const QRegularExpression UrlFilter::FullUrlRegExp(QLatin1String("(www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[\\w.@-]+"
527+
"([:]((6553[0-5])|(655[0-2][0-9])|(65[0-4][0-9]{2})|(6[0-4][0-9]{3})|([1-5][0-9]{4})|([1-9][0-9]{3})|([1-9][0-9]{2})|([1-9][0-9])|([0-9]))[^0-9])?"
528+
"([/][\\w.@?^=%&/~+#-]+)?"));
529529
/** modify end by ut001121 */
530530

531531
// email address:

0 commit comments

Comments
 (0)