Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Regular expression for hexadecimal number

by mickeyn (Priest)
on Jul 30, 2007 at 12:58 UTC ( #629545=note: print w/ replies, xml ) Need Help??


in reply to Regular expression for hexadecimal number

do mean something like m/0x[0-9a-f]+/ ?

Mickey


Comment on Re: Regular expression for hexadecimal number
Download Code
Re^2: Regular expression for hexadecimal number
by ww (Bishop) on Jul 30, 2007 at 13:16 UTC
    mickeyn

    No!

    No downvote, but your regex misses the limit of 1 to 4 "f"s in OP's statement of the problem.

    See FunkyMonk's prior reply (which <span class="pedantic picky)"> errs (albeit, in it's original form, and only marginally) in the comment at line 4:

    {1,4}  #   between 1 & 4 of them

    only insomuch as the set of integers between "1 & 4" includes only "2" and "3."</span>

    Hmm... :-) maybe the "picky pedantic" tag should enclose this whole note....

      Depends on whether one reads "between 1 & 4" as [1,4] (inclusive; which is what the regex notation used implements) or (1,4) (exclusive; which would be {2,3}). Given that the inclusive sense was implied by the code itself one could probably overlook it (of course there's a huge potential for debate on whether an unqualified between should be read as one or the other . . . :)

      (And if you want pedantic nits to pick, one could also have knocked everyone's use of [0-9a-f] rather than [[:xdigit:]] . . . :)

      Update: Bah, it's [[:xdigit:]] not [[:hexdigit:]]. Never try and pedant before caffeine . . .

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2015-07-06 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls