Skip to content

Commit

Permalink
updated safe js regex
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcongdon committed Dec 16, 2024
1 parent 7e4681b commit ec7da24
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vHC/HC_Reporting/ReportScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ function sortTableByColumn(table, column, asc = true) {
const aColText = a.querySelector(`td:nth-child(${column + 1})`).textContent.trim();
const bColText = b.querySelector(`td:nth-child(${column + 1})`).textContent.trim();

const aStartsWithNumber = /^\d/.test(aColText);
const bStartsWithNumber = /^\d/.test(bColText);
const aStartsWithNumber = /^\d/.test(aColText); // Safe regex pattern
const bStartsWithNumber = /^\d/.test(bColText); // Safe regex pattern


if (aStartsWithNumber && bStartsWithNumber) {
const aColNumber = parseFloat(aColText);
Expand Down

0 comments on commit ec7da24

Please sign in to comment.