oops, this one works!
<?php
$str = "1234567890abcefdac127dce4
if (preg_match("/^[0-9a-f]{32
echo "correct";
}
else {
echo "incorrect";
}
?>
Main Topics
Browse All TopicsOk, here is what I need to do:
The game I play generates a unique ID for each player. This ID is 32 characters long, and contains only numbers 0-9 and letters a-f (I beleive it is an MD5 hash). A common error when entering this ID into forms is they miss letters out or use o's (O) or l's (L) instead of zeros and ones.
The missing letters is easy (strlen), but what about each letter/number? I realise I could loop through each letter/number and check it's ASCII code is within the two ranges, but is there some snazzy ereg code I can use? Or would the loop be better?
Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: keteracelPosted on 2005-05-17 at 10:34:02ID: 14020761
if (preg_match("/$[0-9a-f]{32 }^/", $str)) {
echo "correct";
}