Jump to content

[SOLVED] How do I make sure a string is [:alnum:]


sardonicgem

Recommended Posts

The form field is case sensitive. Also I'm not quite sure how preg_match works.

 

php.net indicates:

 

preg_match() returns the number of times pattern  matches. That will be either 0 times (no match) or 1 time because preg_match() will stop searching after the first match.

 

So suppose my string was "Pa55word"

 

preg_match( '[:alnum:]',"Pa55word")

 

So according to the return value conditions, will preg_match stop searching after P?

Link to comment
Share on other sites

that  is why your making a pattern if you make a pattern that will only search for a certain words then your conclusion is applicable here

but if your pattern tries to match not just a word then thats another way

Link to comment
Share on other sites

Thanx for the response teng84 but I'm not quite sure I understand what you're talking about.  In my case above will preg_match stop searching after the letter P?  If so,  is there a function that you know of that can search all characters of the input string and confirm that they are all [:alnum:]?

 

 

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.