Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Validating Hex Numbers

by kal (Hermit)
on Jan 08, 2003 at 22:20 UTC ( [id://225374]=note: print w/replies, xml ) Need Help??


in reply to Validating Hex Numbers

That doesn't look too bad, although you might want to think along the lines of /^[0-9a-fA-F]+$/, which is "$string is a hex number", rather than "$string contains a hex number"

Don't think so much about the e-mail validation - that's a special case, because there are so many levels on which an e-mail address could be valid (valid format for an email address, leads to a valid e-mail box, etc..)

If you want to be rock-solid, you might want to look at the different formats people write hex numbers: I've seen 0a12 written as 0x0a12, 0A12H, and there are probably a few other variations. But, if your code above is good for the data you're processing, then it's great.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://225374]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found