in reply to Regular expression for hexadecimal number

/^ # start of string 0x # 0x prefix [0-9A-F] # a hex digit {1,4} # 1 to 4 of them $ # end of string /xi # x = allow spaces & comments in regexp # i = ignore case

or just /^0x[0-9A-F]{1,4}$/i

update: slight rewording to keep ww happy;)