Did you also export LANG=en_US.utf8 before running it? The current shell could have it’s own independent idea of locale.
As a separate matter, the test could be rewritten to be less locale sensitive:
#!/bin/bash
re='[^abcdefghijklmnopqrstuvwxyz0123456789_.-]'
if [[ $1 =~ $re ]];
then
echo "ERROR: Config name must not contain upper case characters, spaces or special characters. Correct config name and rerun $0."
fi
But maybe people wanted [configname] to work…