View Full Version : Is there any difference between these RegEx patterns?

01-03-2004, 07:34 AM
I'd like to validate input of a classid - registry key value:
"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" -- where "x" is a hex-digit.







- just want to know if the shortest one is best... or if this can be further condensed.

<edit>fixed a mistake in the last one :rolleyes: </edit>

01-03-2004, 11:02 AM
Can you go [0-F] ? I think that has to be [0-9A-F].

Those {1} are certainly unecessary, and you could probably loop the middle bit if ([blah]{n}){n} is allowed .. so:


i'm typing off the top of my head here .. haven't tested it ..

01-03-2004, 11:34 AM
Hey now, that seems to work... & much shorter too! :thumbsup:

- didn't expect the [0-F] to fly, but I can't make it miss either... are there any characters between [0-9] & [A-F] that could sneak in there?

01-03-2004, 11:37 AM
in a classid? I'm not sure ... don't think so

01-05-2004, 05:30 AM
ah, I found the ASCII range: [0123456789:;<=>?@ABCDEF]...

so, [0-F] would allow these non-hex characters to validate [: ; < = > ? @]

oops :D

01-05-2004, 10:11 PM
Oh right .. I didn't realise you can span whole ASCII ranges, I though it was in discrete sets of numbers and letters.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum