将数字添加到preg_match

I have this function:

!preg_match("/^[a-zA-Z\. ]*$/", $home)

How I can correctly add numbers 0-9 in here ?

Thanks Toni.

You can do it like this -

/^[a-zA-Z0-9\. ]*$/

You can test this at http://regexpal.com/

You want the text to consist of 0 or more alphabetics, digits, periods (dots), and blanks (ASCII x20)?

/^[a-z0-9. ]*$/i 

is one way. Notice that you do not need to escape the period within a class. You may be able to use "shortcuts" such as \w, but the above is short and understandable. If you want any whitespace, including tabs, replace the blank with \s. You can add an "s" flag to treat endlines as whitespace.