on my php i use preg_match
to validate input texts.
if(preg_match('/^[a-zA-Z0-9]+$/', $firstname)) {
}
But this only allows alphanumeric and does not allow spaces. I want to allow spaces, alpha and numeric. and period(.) and dash(-)
Please help me out here? thanks in advance.
Use
preg_match('/^[a-z0-9 .\-]+$/i', $firstname)