Jump to content

Would this match letters only no matter case?


aeroswat

Recommended Posts

sure, that would work, though opposite of what you're asking.  If it finds anything that is not a-z or A-Z it will return true.  So true means the string has more than just letters, false means that it IS only a-z or A-Z

 

if you want to have it return true if the string is only case insensitive letters, you would need to do this:

 

preg_match("/^[a-z]+$/i',$str);

 

 

Link to comment
Share on other sites

sure, that would work, though opposite of what you're asking.  If it finds anything that is not a-z or A-Z it will return true.  So true means the string has more than just letters, false means that it IS only a-z or A-Z

 

if you want to have it return true if the string is only case insensitive letters, you would need to do this:

 

preg_match("/^[a-z]+$/i',$str);

 

I got it to do what I needed it to do without even full knowing what I needed it to do lol ;)

It worked the way I wanted it to the way I wrote it. Thankyou for the help and explanation :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.