Skip to content

Commit b532bc5

Browse files
committed
Fix poorly performing regex
1 parent 1203ec2 commit b532bc5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/commands/showPlanPanel.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ function formatTextBlock(text: string): string {
2727
// for those sections to help users visually draw the link between them
2828
if (lineTrim.includes(" module ") || lineTrim.includes("subquery ") || lineTrim.includes("subqueries ")) {
2929
lineTrim = lineTrim
30-
.replace(/(Call|in) (module [A-Z]|\d+)/g, '$1 <span class="module">$2</span>')
31-
.replace(/subquery [A-Z]|\d+/g, '<span class="subquery">$&</span>')
32-
.replace(/subqueries (?:[A-Z]|\d+)(?:, [A-Z]|\d+)*,? and [A-Z]|\d+/g, (match: string): string =>
30+
.replace(/(Call|in) (module [A-Z]|\d{1,5})/g, '$1 <span class="module">$2</span>')
31+
.replace(/subquery [A-Z]|\d{1,5}/g, '<span class="subquery">$&</span>')
32+
.replace(/subqueries (?:[A-Z]|\d{1,5})(?:, [A-Z]|\d{1,5})*,? and [A-Z]|\d{1,5}/g, (match: string): string =>
3333
match
34-
.replace(/subqueries [A-Z]|\d+/, '<span class="subquery">$&</span>')
35-
.replace(/(,|and) ([A-Z]|\d+)/g, '$1 <span class="subquery">$2</span>')
34+
.replace(/subqueries [A-Z]|\d{1,5}/, '<span class="subquery">$&</span>')
35+
.replace(/(,|and) ([A-Z]|\d{1,5})/g, '$1 <span class="subquery">$2</span>')
3636
);
3737
}
3838
const indent = line.search(/\S/) - 1;

0 commit comments

Comments
 (0)