diff --git a/src/routes/tutorial/[slug]/Menu.svelte b/src/routes/tutorial/[slug]/Menu.svelte index 3c682c727..aec676cc3 100644 --- a/src/routes/tutorial/[slug]/Menu.svelte +++ b/src/routes/tutorial/[slug]/Menu.svelte @@ -25,7 +25,8 @@ $: expanded_part = current.part.slug; $: expanded_chapter = current.chapter.slug; - $: regex = new RegExp(`\\b${search.length >= 2 ? search : ''}`, 'i'); + $: escaped = search.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); + $: regex = new RegExp(`\\b${search.length >= 2 ? escaped : ''}`, 'i'); $: filtered = index .map((part) => { @@ -147,6 +148,8 @@ {/if} + {:else} +
  • No search results!
  • {/each}