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;
If you need to ALLOW only space you'll need '/ /'
If you need to ALLOW any whitespace char (space, tab, newline) - use '/\s/'
And if you need to add a space to your pattern (means to ignore space) - use /[^A-Za-z0-9_\ -]/