What on earth is wrong with this reg ex?

Winston

Well-known member
Joined
Jan 25, 2003
Messages
266
Location
Sydney, Australia
Ok im trying to validate that the text is in the format of


oneOrMoreDigits - oneOrMoreDigits

i.e. 56 - 577

0-234

this is what i have


[\d]+ [-] [\d]+

Why on earth doesnt that validate?

Im trying to make it so it only validates like that, and that if theres any other foriegh characters inserted in there, it will fail.


Thanks guys.
 
Hmmm thanks that works, id like to give it support for no spaces as well

i.e.

134-156

no spaces in between the hyphen.


EDIT

i fixed it, just replaced + with *


Thanks for that mate.
 
Back
Top