From 739bebab58e6a89cb79a8d85cf1d3d5f514f23f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Kilchenmann?= Date: Fri, 21 May 2021 13:46:45 +0200 Subject: [PATCH] chore(project): resolve regex term (DSP-1654) (#444) --- .../project/collaboration/add-user/add-user.component.ts | 8 ++++---- src/app/project/project-form/project-form.component.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/project/collaboration/add-user/add-user.component.ts b/src/app/project/collaboration/add-user/add-user.component.ts index 8d2b91eeb3..e6434d72ad 100644 --- a/src/app/project/collaboration/add-user/add-user.component.ts +++ b/src/app/project/collaboration/add-user/add-user.component.ts @@ -149,11 +149,11 @@ export class AddUserComponent implements OnInit { // if the user is already member of the project // add the email to the list of existing this.existingEmailInProject.push( - new RegExp('(?:^|\W)' + m.email.toLowerCase() + '(?:$|\W)') + new RegExp('(?:^|W)' + m.email.toLowerCase() + '(?:$|W)') ); // add username to the list of existing this.existingUsernameInProject.push( - new RegExp('(?:^|\W)' + m.username.toLowerCase() + '(?:$|\W)') + new RegExp('(?:^|W)' + m.username.toLowerCase() + '(?:$|W)') ); } @@ -163,11 +163,11 @@ export class AddUserComponent implements OnInit { // if the user is already member of the project // add the email to the list of existing this.existingEmails.push( - new RegExp('(?:^|\W)' + u.email.toLowerCase() + '(?:$|\W)') + new RegExp('(?:^|W)' + u.email.toLowerCase() + '(?:$|W)') ); // add username to the list of existing this.existingUsernames.push( - new RegExp('(?:^|\W)' + u.username.toLowerCase() + '(?:$|\W)') + new RegExp('(?:^|W)' + u.username.toLowerCase() + '(?:$|W)') ); let existsInProject = ''; diff --git a/src/app/project/project-form/project-form.component.ts b/src/app/project/project-form/project-form.component.ts index 2f625ac270..b62a2e346b 100644 --- a/src/app/project/project-form/project-form.component.ts +++ b/src/app/project/project-form/project-form.component.ts @@ -172,10 +172,10 @@ export class ProjectFormComponent implements OnInit { for (const project of response.body.projects) { - this.existingShortNames.push(new RegExp('(?:^|\W)' + project.shortname.toLowerCase() + '(?:$|\W)')); + this.existingShortNames.push(new RegExp('(?:^|W)' + project.shortname.toLowerCase() + '(?:$|W)')); if (project.shortcode !== null) { - this.existingShortcodes.push(new RegExp('(?:^|\W)' + project.shortcode.toLowerCase() + '(?:$|\W)')); + this.existingShortcodes.push(new RegExp('(?:^|W)' + project.shortcode.toLowerCase() + '(?:$|W)')); } } },