PHP – Regex: Check If String Contains Character Other Than A-Z


if (preg_match (‘/[^a-z]/i’, $string_to_check)) {
// The string contains characters other than a-z and A-Z
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s