I use a regular expression to on a user-inputted field to make sure that they have entered between 1 and 20 characters.
Here's the code:
$post_validations = array("title" => '/^[[:alnum:][:punct:][:space:]]{1,100}$/');
But whenever a user enters a foreign character, or a special quote character from MS Word (I can't paste it into here, it converts it to a normal quote!) the regex doesn't return true, and it shows an error.
I wondered what would be the best regex to use?
Thanks