Skip to content

Commit

Permalink
Be defensive about another potential regex blowup
Browse files Browse the repository at this point in the history
  • Loading branch information
mdirolf committed Mar 29, 2024
1 parent 392a7fc commit cf01477
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/lib/viewableGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ export function getRefs(grid: CluedGrid): [Set<number>[], RefPosition[][]] {
const refPos: RefPosition[] = [];
let match;
const re =
/(?<numSection>(,? ?(and)? ?\b\d+-? ?)+)(?<dir>a(cross(es)?)?|d(owns?)?)\b/gi;
/(?=(?<numSection>(,? ?(and)? ?\b\d+-? ?)+))\k<numSection>(?<dir>a(cross(es)?)?|d(owns?)?)\b/gi;
while (!e.clue.startsWith('!@') && (match = re.exec(e.clue)) !== null) {
const dirString = match.groups?.dir?.toLowerCase();
if (!dirString) {
Expand Down

0 comments on commit cf01477

Please sign in to comment.