Jump to content

[SOLVED] only letters and numbers min. 8 max. 12 characters


dadamssg

Recommended Posts

im tryin to write a pattern that must have 8 to 12 characters in it, and can only be letters or numbers, would i be close with something like this?

 

ereg("^[A-Za-z]{8,9,10,11,12}$")

 

i don't think i did the {} part right though

 

i see an example of a patter, not really sure what it checks for but here it is

 

ereg("^[A-Za-z' -]{1,50}$")

 

im basing mine kind of off this

Link to comment
Share on other sites

that eregi matches letters, a single quote, a space or a dash. no numbers.  It also matches up to 14 chars.  Also, you don't want to use eregi, because it will no longer be part of the core in php6, because the posix functions (eregxxx) suck compared to the pcre functions (pregxxx)

 

If the preg_match one didn't work for you, try trimming the posted var first.

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.