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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.