Forum Moderators: coopster
/^[A-Za-z[:space:][:punct:][0-9]\.\-]+$/ Thanks!
/^[[:alnum:][:space:][:punct:]]+$/
Do you have a test string that should fail to match?
If the string contains anything else other then what I said it should fail the check.
Right now you are telling it to allow anything that at least starts with (^), ends with ($) and includes at least one of (+) those characters found in the character class (stuff in between the brackets). The way it is written you will allow the string to include any OTHER character that you don't want as well.
The correct way to do this is to put the *good* characters in your class and then negate the whole works. If you get a hit, then you have a problem.
And, as mentioned, first you need to get the brackets off your digits range, you are already inside a character class so you don't want to do that again.
$pattern = "/[^A-Za-z[:space:][:punct:]0-9\.\-]/";