Thank you in advance for you time in helping with this issue..
preg_match(): Compilation failed: invalid range in character class at offset 20 sessio
Your error is dependent on your regex interpreter.
You can escape hyphen to be clear about its use. Meaning using \- instead of -.
\-
-
Your final code:
/^[a-z0-9]([0-9a-z_\-\s])+$/i