diff --git a/src/lib/components/workspace/Prompts/PromptEditor.svelte b/src/lib/components/workspace/Prompts/PromptEditor.svelte index 789fd40bfb..de71a1cb9b 100644 --- a/src/lib/components/workspace/Prompts/PromptEditor.svelte +++ b/src/lib/components/workspace/Prompts/PromptEditor.svelte @@ -59,8 +59,8 @@ }; const validateCommandString = (inputString) => { - // Regular expression to match only alphanumeric characters and hyphen - const regex = /^[a-zA-Z0-9-]+$/; + // Regular expression to match only alphanumeric characters, hyphen, and underscore + const regex = /^[a-zA-Z0-9-_]+$/; // Test the input string against the regular expression return regex.test(inputString); diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index 6fe6f0a2fb..21f15ca292 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -1389,8 +1389,8 @@ export const slugify = (str: string): string => { .replace(/[\u0300-\u036f]/g, '') // 3. Replace any sequence of whitespace with a single hyphen .replace(/\s+/g, '-') - // 4. Remove all characters except alphanumeric characters and hyphens - .replace(/[^a-zA-Z0-9-]/g, '') + // 4. Remove all characters except alphanumeric characters, hyphens, and underscores + .replace(/[^a-zA-Z0-9-_]/g, '') // 5. Convert to lowercase .toLowerCase() );