What on earth is wrong with this reg ex?

Winston

Junior Contributor
Joined
Jan 25, 2003
Messages
266
Location
Sydney, Australia
Ok i'm 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 doesn't that validate?

I'm trying to make it so it only validates like that, and that if there's 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