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 8246315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:28:01+00:00 2026-06-07T22:28:01+00:00

I want a regular expression code which allows only numeric phone number (e.g 1234567890)

  • 0

I want a regular expression code which allows only numeric phone number (e.g 1234567890) as well as GB format number (e.g 123-456-7890).

This expression must have to work for both conditions.

Currently I am using below regular expression which only allows GB phone number

/^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/ 

I need help to allow only numeric number also.

  • 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-07T22:28:02+00:00Added an answer on June 7, 2026 at 10:28 pm

    There are some UK phone number regular expressions here.

    The most highly rated one from that page is:

    ^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$
    

    It is described as:

    Matches     +447222555555   | +44 7222 555 555 | (0722) 5555555 #2222
    Non-Matches (+447222)555555 | +44(7222)555555  | (0722) 5555555 #22
    

    Personally I would not put a strict regex on a phone number unless it is absolutely required to have the users actual phone number for identity verification or something involving payments. There are lots of variations of phone numbers, some users could even use Skype as their primary phone, and by putting a validation on you’re just going to block/frustrate users.

    Also note you have got the UK format wrong, UK phone numbers should contain 11 digits and are normally in the format (01234) 123123 – we never use dashes and first number should always be a 0.

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

Sidebar

Related Questions

I want a regular expression for a textbox which allows only 3 digits and
i want the best regular expression to replace this code <a href=http:// www.badoobook.com/clips/index.php?page=videos&section=view&vid_id=100162> www.badoobook.com/clips/inde......&vid_id=100162
I want regular expression in ruby on rails which remove all the html tags
I want a regular expression for only accepting 0-9999 No spaces, no letters. However,
i want a regular expression to validate string to have only text,operators and these
I want a regular expression that validate a string that allow only numbers and
i want a regular expression that contains alpha and numeric characters and must be
I want to be able to construct a regular expression which searches for a
i want the regular expression to sanitize my data which should meet the following
Is it possible to write code which generates a regular expression or XPath that

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.