I\'m such an amateur at regex, how do I allow spaces(doesn\'t matter how many) in this regex?
if(preg_match(\'/[^A-Za-z0-9_-]/\', $str)) return FALSE;
Not so much an answer to your question, but a site I find useful for checking regex expressions. It also explains what each part of the expression does / means as you hover over it in the input field.