Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6387067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:06:21+00:00 2026-05-25T03:06:21+00:00

I find all kinds of phone number validations on stackoverflow for the iphone but

  • 0

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.

Goals: this number is being entered via an alert. North American with or with out dashes.

so have some code but every thing is coming up as invalid any ideas.

- (void)textFieldDidEndEditing:(UITextField *)textField {

NSString *str=@"^\\+(?:[0-9] ?){6,14}[0-9]$";
NSPredicate *no=[NSPredicate predicateWithFormat:@"SELF MATCHES %@",str];
if([no evaluateWithObject:textField.text]==NO)
   { 

       UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Warning" message:@"Please Enter correct contact no." delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];

       [alert show];
       [alert release];

   }
   else{
NSString *textValue = textField.text;
NSLog(@"Value: %@", textValue);
   }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:06:22+00:00Added an answer on May 25, 2026 at 3:06 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to find all CIDs (Contracts) meet the following conditions They are active
I'm trying to find all Users with an id greater than 200, but I'm
I'm trying to find all element that contains all words in a phrase after
how can i find all the anchor tags with source pdf $string=hello this is
I need to find all the occurences of a file Test.TXT in c:\ or
I want to find all the demo words using PHP and regEx. $input ='demo';
I'm trying to find all href links on a webpage and replace the link
I need to find all occurences of 'Of' (case sensitive) in table Cities .
I want to find all foreign keys in a table, and for each foreign
roles = Role.find_all_by_simulation_id(session[:sim_id]) forum_posts = Post.find(:all, :conditions => [role_id = ? AND created_at >

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.