mirror of
https://github.com/hexastack/hexabot
synced 2025-05-31 10:57:06 +00:00
fix: regex to exact match
This commit is contained in:
parent
7da5a45afc
commit
67314a6440
@ -92,8 +92,8 @@ export class NlpSampleEntityService extends BaseService<
|
||||
value: NlpValue,
|
||||
): NlpSampleEntityCreateDto[] {
|
||||
const keywords = [value.value, ...value.expressions];
|
||||
const regex = `\\b(${keywords.join('|')})\\b`;
|
||||
const regexPattern = new RegExp(regex, 'gi');
|
||||
const regex = `(?<!\\p{L})${keywords.join('|')}(?!\\p{L})`;
|
||||
const regexPattern = new RegExp(regex, 'giu');
|
||||
const matches: NlpSampleEntityCreateDto[] = [];
|
||||
let match: RegExpExecArray | null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user