From 2770996eabde3181718778576608ae421caf55c4 Mon Sep 17 00:00:00 2001 From: mDuo13 Date: Fri, 15 Jan 2021 15:47:35 -0800 Subject: [PATCH] Interactive tutorials: fix bug with multiple spaces --- assets/js/interactive-tutorial.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/interactive-tutorial.js b/assets/js/interactive-tutorial.js index 77e076c76e..c950956b0e 100644 --- a/assets/js/interactive-tutorial.js +++ b/assets/js/interactive-tutorial.js @@ -1,8 +1,8 @@ // Helper functions for interactive tutorials function slugify(s) { - const unacceptable_chars = /[^A-Za-z0-9._ ]+/ - const whitespace_regex = /\s+/ + const unacceptable_chars = /[^A-Za-z0-9._ ]+/g + const whitespace_regex = /\s+/g s = s.replace(unacceptable_chars, "") s = s.replace(whitespace_regex, "_") s = s.toLowerCase()