On Tuesday, April 16, 2002, at 09:51 AM, [EMAIL PROTECTED] wrote:
> > Thanks for this answer. > > But how can i test if i actually have numbers AND letters ? preg_match('/([A-Za-z].*[\d]|[\d].*[A-Za-z]/', $string); Untested, but in theory should work. > On Tuesday, April 16, 2002, at 08:49 AM, [EMAIL PROTECTED] wrote: > >> >> I'm new with RegEx and I would like to use them to validate my forms >> entries submitted to the server. >> >> My question is how can I verify with the regex that a string is >> - at least 7 chars >> - contains Chars and Nums >> - may contains some special chars (ex : % ! : ; , )but not in first or >> last >> position . > > I'm assuming that by Chars you mean uppercase/lowercase letters? > Numbers are characters too, I thought. > > preg_match('/^[A-Za-z0-9][A-Za-z0-9%!:;,]{5,}[A-Za-z0-9]$/', $string); > > The above regex will only match a string that begins with A-Z or a-z or > 0-9, then any number of characters that are in the middle character > class, then a final A-Z or a-z or 0-9. > > I think. Try it out, that's untested. > > > Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php