I find all kinds of phone number validations on stackoverflow for the iphone but none seem to validate they just seem to change the format. example Phone number formatting.
First, real phone number validation is pretty complicated. Are you limiting yourself to NANP (North America Numbering Plan), or are you looking for E.164 numbers? It looks like you're trying to mostly match E.164, though this isn't usually the kind of number that most people would enter.
Your match requires a plus, followed by a sequence of digits between seven and fifteen long with optional spaces between them. Is this what you mean? What strings are you passing in?
Note that as of iOS4, there is NSRegularExpression
that is a bit better for this than NSPredicate
.