What is the easiest or best way in PHP to validate true or false that a string only contains characters that can be typed using a standard US or UK keyboard with the keyboard language set to UK or US English?
To be a little more specific, I mean using a single key depression with or without using the shift key.
I think the characters are the following. 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~`!@#$%^&*()_-+={[}]|\:;”‘<,>.?/£ and Space
You can cover every ASCII character by
[ -~](i.e. range from space to tilde). Then just add£too and there you go (you might need to add other characters as well, such as±and§, but for that, have a look at the US and UK keyboard layouts).Something like: