Interactive tutorials: fix bug with multiple spaces

This commit is contained in:
mDuo13
2021-01-15 15:47:35 -08:00
parent bb46c3206e
commit 2770996eab

View File

@@ -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()