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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:49:39+00:00 2026-06-15T13:49:39+00:00

I am using regular expression to validate the mobile number with the following criteria:

  • 0

I am using regular expression to validate the mobile number with the following criteria:

  1. Maximum of 12 numbers.
  2. It should start with Zero.
  3. Will allow only one space (at a non-defined point)
  4. Followed by an optional extension number of up to five digits in length, not including the # sign

My Regular Expression looks like below: (I have tested this with “rubular” tester)

^((0((?=\d* \d*#)[\d ]{,11})(#\d{,5})?)|(0(?:\d{,10})(#\d{,5})?)|(0((?=\d* \d*$)[\d ]{,11})))$

But it’s not working in .net regular expression engine.

Can someone tell me, in the above one which part doesn’t work with .net regular expression engine? and if I can change anything in the above expression will it work in .Net regular expression engine?

  • 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-15T13:49:40+00:00Added an answer on June 15, 2026 at 1:49 pm

    The only problem in your regex is that you are not specifying the starting range anywhere.. so it should be {0,11} or {1,11} not {,11}


    You can also use this simplified regex

    ^(?=(\S*[\s]\S*|\S*)$)0(\s?\d){1,11}\s?(#(\s?\d){1,5})?\s?$
    

    \S matches any character that is not space

    (\S*[\s]\S*|\S*)$ matches 0 to many non space character followed by a space followed by 0 to many non space characters till end OR it matches all the non space character till end

    (?=) is a positive lookahead which check if particular pattern occurs and if not it will not match!

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

Sidebar

Related Questions

How to validate zipcode using regular expression? It should be in the following pattern:-
I am using the following regular expression to validate e-mails, but it allows empty
How to validate a mobile number textbox and email textbox using regular expressions in
I'm very new in regular expression and I'm trying to validate date using following
i have the following code to validate my file name entered using regular expression
Need a regular expression to validate username which: should allow trailing spaces but not
I'm using the following regular expression to validate emails: ^\w+([-.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$ Now I want to
I'm using the following regular expression on php to validate dates: if(!preg_match(/^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/([12][0-9]{3})$/i,$date_born)){ But i
I am using the following regular expression to validate a comma delimited list of
I need to validate the user input using regular expression. It should be a

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.