6 digit reg expression

Posted on 2006-04-05
Last Modified: 2008-03-06
What's a regular expression for a 6-digit alphanumeric string
Question by:weikelbob
    LVL 3

    Expert Comment

    Using POSIX Extended regular expressions

    for ereg based functions use "[0-9a-zA_Z]{6,6}"
    for eregi based functions use "[0-9a-z]{6,6}"
    LVL 3

    Accepted Solution

    Sorry typo should have read A-Z not A_Z

     Using POSIX Extended regular expressions

    for ereg based functions use "[0-9a-zA-Z]{6,6}"
    for eregi based functions use "[0-9a-z]{6,6}"

    LVL 9

    Assisted Solution

    LVL 9

    Assisted Solution

    if (eregi('^[a-z0-9]{6}$', $alphanumericvalue))  echo "its alphanumeric";
    else echo "its not alphanumeric";
    LVL 7

    Author Comment

    Thank you guys.

    Featured Post

    Easy Project Management (No User Manual Required)

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now