Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/apps/review/src/lib/utils/metadataMatching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ export function findMetadataPhaseMatch(
}

// Replace all sequences of space, underscore, or hyphen in the target with a placeholder
const WORDSEP_PLACEHOLDER = '__WORDSEP__';
const sepPattern = /[ \-_]+/g;
const targetWithPlaceholder = target.replace(sepPattern, WORDSEP_PLACEHOLDER);
const WORDSEP_PLACEHOLDER = '__WORDSEP__'
const sepPattern = /[ \-_]+/g
const targetWithPlaceholder = target.replace(sepPattern, WORDSEP_PLACEHOLDER)
// Properly escape ALL regex metacharacters (including backslash), leaving the placeholder intact
const escapedTarget = escapeRegexLiteral(targetWithPlaceholder)
.replace(new RegExp(escapeRegexLiteral(WORDSEP_PLACEHOLDER), 'g'), '[-_\\s]+');
const sepInsensitive = new RegExp(`\\b${escapedTarget}\\b`);
.replace(new RegExp(escapeRegexLiteral(WORDSEP_PLACEHOLDER), 'g'), '[-_\\s]+')
const sepInsensitive = new RegExp(`\\b${escapedTarget}\\b`)
if (sepInsensitive.test(normalizedMetadata)) {
return { source: 'stringBoundary' }
}
Expand Down
Loading