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

  • SEARCH
  • Home
  • 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 8032341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:21:30+00:00 2026-06-05T01:21:30+00:00

What are the rules for validating a North American phone number? Also, is there

  • 0

What are the rules for validating a North American phone number? Also, is there a regex I can use? Is there a gem to do this?

Here are few rules I have in mind

  1. A 10 digit number
  2. no special characters
  3. A positive number
  • 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-06-05T01:21:31+00:00Added an answer on June 5, 2026 at 1:21 am

    There are many gems that will do this for you.

    Take a look at: http://rubygems.org/search?utf8=%E2%9C%93&query=phone+number

    This one looks like it will do what you need — it essentially implements a regex to validate the phone number: http://rubygems.org/gems/validates_phone_number

    For US, Canada (Bermuda, Bahamas… etc and all +1 numbers) there are other rules that the regex should follow. The first digit (after the +1) must be 2-9.

    For a full list see: http://en.wikipedia.org/wiki/North_American_Numbering_Plan

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

Sidebar

Related Questions

When validating prices with CI I use the following rule; $this->form_validation->set_rules('price','lang:price','required|numeric|greater_than[0.99]'); Is there any
Are there are any rules for when to use Client-Side validation and when to
How can I add rules to Visual Studio (2005 and up) for validating property
I have TextBox on my page. I want to validating this textbox. The rules
Castle Validator uses attributes to specify validation rules. How can you hook these up
On jQuery site Plugins/Validation/Methods/digits there is example: $(#myform).validate({ rules: { field: { required: true,
I am validating form using jquery validation plugin...... rules: { Name: required, MobileNo: {
I have a few custom form validation rules I wish to apply. Things like
I used a JQuery Validation script for validating an HTML Form. This worked perfectly
I'm trying to use the jQuery validation plugin (from here --> http://bassistance.de/jquery-plugins/jquery-plugin-validation/ ) to

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.