From f5adc5732be90ef8d7258e5f1e39d457ef694678 Mon Sep 17 00:00:00 2001 From: Nuwan Sameera Alawatta Date: Mon, 19 Oct 2020 10:48:27 +0530 Subject: [PATCH] Fix page name special character bug (#1035) * Fix page name special character bug * update fix page name special character bug * fix page name ending space --- app/client/src/utils/helpers.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/client/src/utils/helpers.tsx b/app/client/src/utils/helpers.tsx index 8b8b3ca11b..826682644d 100644 --- a/app/client/src/utils/helpers.tsx +++ b/app/client/src/utils/helpers.tsx @@ -102,9 +102,12 @@ export const flashElementById = (id: string) => { }; export const resolveAsSpaceChar = (value: string, limit?: number) => { - const separatorRegex = /[\W_]+/; + const separatorRegex = /[^\w\s]/; + const duplicateSpaceRegex = /\s+/; return value .split(separatorRegex) + .join("") + .split(duplicateSpaceRegex) .join(" ") .slice(0, limit || 30); };