浏览代码

Potential fix for code scanning alert no. 3: Inefficient regular expression

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
lechibang-1512 2 个月前
父节点
当前提交
2ebe88d7a2
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      sortable.js

+ 2
- 2
sortable.js 查看文件

@@ -104,9 +104,9 @@ function ts_resortTable(lnk, clid) {
104 104
 	sortfn = ts_sort_caseinsensitive;
105 105
 	if (itm.match(/^\d\d[\/\.-][a-zA-z][a-zA-Z][a-zA-Z][\/\.-]\d\d\d\d$/)) sortfn = ts_sort_date;
106 106
 	if (itm.match(/^\d\d[\/\.-]\d\d[\/\.-]\d\d\d{2}?$/)) sortfn = ts_sort_date;
107
-	if (itm.match(/^-?[£$€Û¢´]\d/)) sortfn = ts_sort_numeric;
107
+	if (itm.match(/^-?[£$€Û¢´]\d/)) sortfn = ts_sort_numeric;
108 108
 	// ignore stuff in () after the numbers.
109
-	if (itm.match(/^-?(\d+[,\.]?)+(E[-+][\d]+)?%?( \(.*\))?$/)) sortfn = ts_sort_numeric;
109
+	if (itm.match(/^-?\d+([,\.]\d+)*(E[-+][\d]+)?%?( \(.*\))?$/)) sortfn = ts_sort_numeric;
110 110
 	SORT_COLUMN_INDEX = column;
111 111
 	var firstRow = new Array();
112 112
 	var newRows = new Array();