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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:53:32+00:00 2026-05-16T15:53:32+00:00

I need my users to input very specific cell phone format cause my app

  • 0

I need my users to input very specific cell phone format cause my app will be sending sms to them

So, I need their cell phone formats to be like this

04AB-XXXXXXX

Where A can be either 1 or 2

and B can be either 2, 4 or 6

X can be from 0-9
There must be exactly 7 numbers (X) after 04AB

It must always start with 04

Examples:

04140000000 allowed

04240000000 allowed

04340000000 not allowed

14240000000 not allowed

04170000000 not allowed

So my property would need a regular expression validator but I wouldnt even know where to start… I just got this from a tutorial but it’s for a different format

[RegularExpression(@"^\$?\d+(\.(\d{2}))?$")]

this needs to be as strictly as possible because its gonna be used for text messaging.
thanks in advance..

  • 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-16T15:53:33+00:00Added an answer on May 16, 2026 at 3:53 pm

    you need this:

    ^04[12][246][0-9]{7}$
    

    That is withouth the “-“

    ^04[12][246]-[0-9]{7}$
    

    is with the “-” and

    ^04[12][246]-?[0-9]{7}$
    

    allows to use the “-” or leave it

    the 0-9 can be replaced with \d like (I like [0-9] for beginners readability):

    ^04[12][246]-?[\d]{7}$
    

    so it can become something like:

    [RegularExpression(@"^04[12][246]-?[0-9]{7}$")] 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For my Android app, users need to connect to a server that will be
For my users I need to present a screen where they can input multiple
i will need to generate a report based on user input for every food
I need to check user input from an EditText against the pattern described before
I need to validate the user input of a JSpinner , and if invalid,
I need to validate two user input fields against each other in seam. Field1
I need a modal dialog to gather some user input. I then need the
I need to build an application that accepts user input data (such as name,
Many of us need to deal with user input, search queries, and situations where
How do you deal with user input (unicode) that you need to be restricted

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.